3 ms·
Why you don't need the Y combinator in Perl 6
- sjs 16y agoThe more things change the more they stay the same.
- jerf 16y agoYeesh, the power of language to obfuscate never ceases to amaze me. The power of "anonymous functions" is not in failing to give them a name, it is in your ability to just create one in the flow of another function and have all the mighty power of closures. The anonymity is, in the grand scale of things, quite incidental. I wouldn't say this except for how people go ballistic if their "anonymous functions" aren't supported in a language that has everything else you need. That's silly. You don't need the YCombinator in Perl 5 or Perl 6 because "my $func; $func = sub { $func->(...) }" is perfectly fine. In other news, the importance of "asynchronous" is that it doesn't block, not that you've manually chopped it up into a lengthy stream of event handlers. If it doesn't block, it doesn't block, even if the code on first impression looks like blocking code but in fact the runtime takes care of the continuation transform for you. (Also I can rant about how the word "immutable" gets misinterpreted and cargo-culted but that would be a lengthier post.)
- ced 16y ago(Also I can rant about how the word "immutable" gets misinterpreted and cargo-culted but that would be a lengthier post.) Please do.
- primodemus 16y agohow can I use this when coding mutually recursive functions?
- ced 16y agoLike jerf said, just give them a name and be done with it. Why would you want anonymous, mutually recursive functions? These things are sometimes useful in writing compilers though, but then the transformations are more elaborate.
- linuxhansl 16y agoYou also do not need it in JavaScript. var x = function y() { ... y(); ... } 'y' is only bound within the function and allows the function to refer to itself. I.e. you can have anonymous, recursive functions, which is useful in "memberfunctions". Actually the more common function f() {} is identical to var f = function f() {} and not var f = function() {} Edit: Of course there's also arguments.callee...