in reply to Re: IO::Lambda: call for participation
in thread IO::Lambda: call for participation
In that process I realized that if you indent normally, then after any complex sequence of events you are indented off of the right hand side! And what, exactly, does that indentation tell you? Basically that this happens before that happens before the other thing. Nesting of braces is carrying sequencing information, which we normally don't bother indenting at all.
So once you get past the mechanics of what it is doing under the hood and try to think in terms of this library, what you really need to do is imagine that someone added a very small vaguely Lisp-like language to Perl, and that language is used to achieve the asynchronous magic. And once you think of it that way, the indentation makes perfect sense. You indent all of your Perl in a block by 4. Then outdent all of the commands in this second language by 2 (to indicate that they are this other language). Then let your closing braces pile up. In short at this point you're formatting the Perl bits like Perl, and the IO::Lambda bits like they were Lisp. (And once I figured that out, I understood as I never have before why Lisp people universally format their code that way.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: IO::Lambda: call for participation
by xdg (Monsignor) on Jan 16, 2009 at 11:27 UTC | |
by tilly (Archbishop) on Jan 16, 2009 at 18:25 UTC | |
by dk (Chaplain) on Jan 16, 2009 at 13:07 UTC | |
Re^3: IO::Lambda: call for participation
by dk (Chaplain) on Jan 16, 2009 at 10:02 UTC |