|
|
|
|
|
by a_strange_guy
5444 days ago
|
|
Of those Languages you listed, many don't have implemented function closures correctly. Python doesn't allow you to mutate variables from enclosing scopes (by default, at least). Ruby's blocks aren't first-class, they have to be converted to a Proc object first (and argument passing works differently than for methods). Smalltalk blocks don't have to be able to call themselves recursively by the ANSI standard (most implementations allow that, but eg. Squeak/Pharo does not by default). C on OSX doesn't have GC, so you have to manually specify which variables you want to capture (and how). JavaScript was originally supposed to be Scheme, and thus has implemented lexical closures better than most other languages. ('this' however... don't want to talk about that train wreck) |
|