Ich hasse Javascript mehr als Pizza ohne Käse!
-
-
Replying to @lukas81298
Sometimes I just want to yell "Fuck this", but I can't remember what "this" refers to...
2 replies 0 retweets 7 likes -
Replying to @scrummerlp
Herr JS Profi, könnten Sie mir bitte erklären, wie ich den Variablenwert in den Scope dort hole?
pic.twitter.com/R98nWOUQYf
1 reply 0 retweets 2 likes -
Replying to @lukas81298 @scrummerlp
for (var i = 0; i < 20; i++) { (function (j) { setTimeout(function() { console.log(j); }, 1000); })(i); }
1 reply 0 retweets 0 likes -
Replying to @falschesmodell @scrummerlp
Danke, aber das bestätigt gerade nur, dass JS kacke ist xD
1 reply 0 retweets 1 like -
Replying to @lukas81298 @falschesmodell
Jup das ist leider der einzige (möglichst simple) Weg. Andere möglichkeit wäre den Timeout auszulagern und den i zu übergeben. Aber ist halt leider so :/ Unser Bruder
@BrendanEich muss da echt los...1 reply 0 retweets 2 likes -
Use `let` not `var`. I your brother worked hard to help get this into ES6, where it means that each iteration has its own binding environment, so the closure works as you want it to. Guten Abend!
5 replies 6 retweets 46 likes -
Replying to @BrendanEich @scrummerlp and
I didn’t realize that. So JavaScript declaration-site distinctions between let and var are the analog of C++ lambda-site distractions between capture by variable or by value.
3 replies 0 retweets 5 likes -
Replying to @TimSweeneyEpic @BrendanEich and
Of languages supporting mutability, only Haskell IORef t and ML t ref are voodoo-free in this tegard. There, identifiers are always bound to constants, and references must be explicitly read and written.
3 replies 0 retweets 3 likes
This highlights that in an imperative language, the default loop form should be something like “for(i in 1 to 10) ...” with the semantic that each iteration has a distinct x binding, and no need to explain away why the i’s before and after the i++ are different i’s.
-
-
Replying to @TimSweeneyEpic @BrendanEich and
i.e. C-style for loops are bad. I’ve been saying this to everyone who will listen for years. :)
3 replies 0 retweets 8 likes -
Replying to @pcwalton @TimSweeneyEpic and
isn't this also about by-value vs. by-reference closure conversion? I find it confusing that JS has both.
1 reply 0 retweets 0 likes - 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.