-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stakes in the ground #581
Comments
Variable scopeAlma uses the Seriously, though, I could've gone with Languages like C, C++, Java, C# use the type (like Python and Ruby do not deign to have either keyword or type. They just assign to the new variable, and this assignment also causes it to be declared. I was going to say something dramatic, like "that is Wrong". But Python and Ruby are rather popular, and so clearly a language can reach a respectable level of popularity without explicitly declared variables. All I can really say with certainty is that either I'm wrong, or the unwashed masses are. Ancient-enough versions of C only allowed you to declare local variables at the top of functions. This was, as I understand it, a kind of torturing the programmer to benefit the compiler writer: a function gets a stack frame of a certain size, a size which grows with each new variable declaration. By putting all the declarations at the top, one does not have to recalculate that size halfway through the function. Which brings us to the travesty that is JavaScript's tbd |
HoistingThe classical "folk explanation" of hoisting is pretty dumb. Not because it's super-incorrect — it actually tends to be helpful — but because it's one of those explanations that makes a big deal out of a simple thing, and then fails to explain stuff when it gets complicated. Example of when it succeeds: you can call a function that is "not declared yet". f(); // this call works
function f() {
console.log("whoa!");
} The reason this works, says the dumb explanation, is that the function f() {
console.log("whoa!");
}
f(); Even though that's not what you wrote. Example of when it fails: two functions can call each other. function isEven(n) {
return n === 0 || isOdd(n - 1);
}
function isOdd(n) {
return isEven(n - 1);
} There's no way to use the "hoisting" imagery in this case to show how the code gets rewritten, because you can't physically put two functions above each other. tbd |
Initializationtbd |
Thunkingtbd |
Type conversionstbd |
Object modeltbd |
Generic functionsFunctions are pretty powerful before we even get to generic functions. Here are the modular (but on-by-default) features you get in ordinary functions:
tbd
|
Call-by-value vs call-by-nameIn a pure, effect-free world, there's no observable difference between CBV and CBN. This is something that Paul Blain Levy points out in his dissertation. CBV and CBN arises as two different evaluation strategies. But I recently found a paper where the CBV/CBN distinction is explained quite vividly: Grokking the sequent calculus. xxx |
Macro expansiontbd |
The billion dollar mistaketbd (well, I mean — not planning to (re-)do the mistake itself; planning to write this out later) |
It seems I write these issues these days instead of blog posts. Very well.
This issue is a self-closing one about the new spec I'm writing. Oh right, I'm writing a new spec, check it out! (At the time of writing, I'm up to about chapter 6 or so.)
Anyway, I realized that there were some "soft" topics I wanted to write about, that are more about design sensibilities and "taste" — stakes in the ground — than about the objective things that go in the spec itself. Subjective stuff, basically. But somehow rooted in reasoning, or at least I'd like to think so.
I'll stub out the subsequent sections as individual comments, and then fill them in. After that, I'll close this issue.
The text was updated successfully, but these errors were encountered: