
Why you don't need the Y combinator in Perl 6 - DanielRibeiro
http://perlgeek.de/blog-en/perl-6/y-combinator-not-needed.html
======
jerf
Yeesh, 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
_(Also I can rant about how the word "immutable" gets misinterpreted and
cargo-culted but that would be a lengthier post.)_

Please do.

------
primodemus
how can I use this when coding mutually recursive functions?

~~~
ced
Like 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
You 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...

------
sjs
The more things change the more they stay the same.

