Readit News logoReadit News
sfpotter commented on The Cost of a Closure in C   thephd.dev/the-cost-of-a-... · Posted by u/ingve
unwind · 4 days ago
This was very interesting, and it's obvious from the majority of the text that the author knows a lot about these languages, their implementation, benchmarking corners, and so on. Really!

Therefore it's very jarring with this text after the first C code example:

This uses a static variable to have it persist between both the compare function calls that qsort makes and the main call which (potentially) changes its value to be 1 instead of 0

This feels completely made up, and/or some confusion about things that I would expect an author of a piece like this to really know.

In reality, in this usage (at the global outermost scope level) `static` has nothing to do with persistence. All it does is make the variable "private" to the translation unit (C parliance, read as "C source code file"). The value will "persist" since the global outermost scope can't go out of scope while the program is running.

It's different when used inside a function, then it makes the value persist between invocations, in practice typically by moving the variable from the stack to the "global data" which is generally heap-allocated as the program loads. Note that C does not mention the existence of a stack for local variables, but of course that is the typical implementation on modern systems.

sfpotter · 4 days ago
I had a completely different response reading the sentence. I've been programming in C for 20+ years and am very familiar with exactly the problem the author is discussing. When they referred to a "static variable", I understood immediately that they meant a file static variable private to the translation unit. Didn't feel contrived or made up to me at all; just a reflection of the author's expertise. Precision of language.
sfpotter commented on The Gamma Language   lair.masot.net/gamma/... · Posted by u/RossBencina
masot · 6 days ago
For me, it was just to have some fun seeing whether you can get the convenience of generics in C without blowing up the size of a "minimal standards-compliant compiler." E.g., Chibicc[1] is only a few thousand lines of code; adding Gamma to that would not blow it up by much. There's something aesthetically pleasing about knowing I can read the whole thing in a few days. Nothing like that is possible for C++ (or D?) AFAIK.

But yes --- for a real project I would absolutely recommend someone use D over this !

[1] https://github.com/rui314/chibicc

sfpotter · 6 days ago
Totally fair. Just wondering if there was some specific motivation for being able to do this... "For fun" is valid, IMO. ;-)
sfpotter commented on The Gamma Language   lair.masot.net/gamma/... · Posted by u/RossBencina
sfpotter · 6 days ago
What's the use case for a language like this?

I used to very down on C++ but have stopped caring quite so much... Just using C++ and restricting oneself to templates seems like a better bet than this. Or you could use D and have a language whose template experience is much better than C++'s...

Any language this is going to need debug info eventually. One could step through the generated C code, but this is much less pleasant than stepping through the original source.

I also wonder how name mangling is handled?

sfpotter commented on Vanity activities   quarter--mile.com/vanity-... · Posted by u/surprisetalk
mooreds · 8 days ago
Some good points in here, but with respect to networking, the author misses the forest for the trees.

Sure, when you go to networking events, you aren't certain you are going to get a job from the folks you meet.

What you are doing is increasing your luck surface area. Hiring is not an entirely rational process, but if someone doesn't know you exist, they won't hire you (how could they?).

From there, it follows that meeting someone and letting them know you exist increases the chances (however small) that they can and will assist you on your career path. And a networking opportunity, where you meet someone face to face (and can meet them repeatedly) is a far better way to let someone know you exist than sending them your resume.

There are other ways to raise your profile that don't involve networking events and you can argue that they are better, but that's a cost-benefit analysis you should consider.

sfpotter · 8 days ago
Networking involves more than just letting people know you exist. I'd say that's borderline useless. Actually networking requires building real relationships with people. For me, that means continually meeting new people who do the same kind of thing that I do, having pleasant or exciting conversations with them, learning as much as I can about them (showing a real interest! asking serious questions! listening to their answers!), and demonstrating to them that I'm hungry and I want to do Big Things. It's hard to do this effectively. I'm sure it depends on your field and it certainly requires continual practice.
sfpotter commented on Autism should not be treated as a single condition   economist.com/science-and... · Posted by u/bookofjoe
__MatrixMan__ · 11 days ago
It has always bothered me that by "spectrum" they mean not the sort of continuous thing that spectra actually are, but instead some disjoint set of "colors" any one of which might describe a person. That's called a partition, and its in an entirely separate thing.

When I tell this to people they understand immediately that I am in fact on that "spectrum".

sfpotter · 11 days ago
Fun fact: some spectra are discrete, not continuous! And some have both parts. Depends on the operator...
sfpotter commented on Mathematics is hard for mathematicians to understand too   science.org/doi/10.1126/s... · Posted by u/mmaaz
pathikrit · 12 days ago
I love math but the symbology and notations get in my way. 2 ideas:

1. Can we reinvent notation and symbology? No superscripts or subscripts or greek letters and weird symbols? Just functions with input and output? Verifiable by type systems AND human readable

2. Also, make the symbology hyperlinked i.e. if it uses a theorem or axiom that's not on the paper - hyperlink to its proof and so on..

sfpotter · 12 days ago
Go ahead. Write a math paper with your proposed new notation with hyperlinks and submit it to a journal somewhere.
sfpotter commented on Peter Thiel's Apocalyptic Worldview Is a Dangerous Fantasy   jacobin.com/2025/11/peter... · Posted by u/robtherobber
jmathai · 13 days ago
Maybe slightly off topic to the article, but I don't really care what Peter Thiel has to say. I do think we need to collectively think about how to not give these people a microphone. It's one thing to have concentrated wealth. It's a very different thing to have concentrated wealth and people's attention. I think that's a much more interesting discussion :).
sfpotter · 13 days ago
The issue is that having concentrated wealth and having concentrated people's attention are not separate things.
sfpotter commented on Algorithms for Optimization [pdf]   algorithmsbook.com/optimi... · Posted by u/Anon84
sfpotter · 15 days ago
Can anyone provide a comparison of this book to Nocedal and Wright's book?
sfpotter commented on How good engineers write bad code at big companies   seangoedecke.com/bad-code... · Posted by u/gfysfm
Herring · 17 days ago
sfpotter · 17 days ago
Whoa. Who's this guy? Sounds like he might have some answers to some of my questions!
sfpotter commented on How good engineers write bad code at big companies   seangoedecke.com/bad-code... · Posted by u/gfysfm
alfalfasprout · 17 days ago
Interesting. Coming from big tech, it's actually pretty spot-on of an article. I think most folks at big tech have experienced this stuff too.

> Why is it necessary for big tech companies to act this way? Why does bad code bother engineers so much? Are they actually misguided for feeling like bad code is a catastrophe, or is it really the fault of the broader economic sphere we all inhabit? Is it actually maturity to reconcile ourselves to drift powerlessly as faceless and titanic forces sculpt our reality? So many possible questions.

These are all great questions. I have some thoughts, of course. But I'm not sure it's fair to describe OP as a burnt-out nihilist. The premise of the post is pretty reasonable actually.

sfpotter · 17 days ago
I don't disagree that it's an accurate portrayal of reality. And of course, as I made clear in my post, I don't know if they're actually a burnt out nihilist.

My issue with the article is maybe more that the perspective and framing seem to want to lock out idealism from the conversation and encourage people to become ruthless, hard-nosed pragmatists in order to survive in this environment. Is that actually good, effective, or desirable? Again, lots of questions.

u/sfpotter

KarmaCake day1562August 7, 2022View Original