Scott Bronson wrote:
> On Wed, 2004-06-30 at 18:41, Luke Palmer wrote:
> > Larry didn't go for it.  Note, we already have an operator that puts
> > its left side in void context and evaluates it before its right one: 
> > we call it C<;>.
> 
> But C<;> requires a surrounding do block, as you noted.  I'm
> disappointed that Larry didn't go for it.  To my eyes, C<then> really
> increases readability.

All's fair if you predeclare:

  sub infix:then (&first, &last) {
    &first(); 
    return &last();
  }

The only problem I see with this solution is that I don't think that you
can pass individual commands into code variables:

  pray_to $_ then sacrifice <$virgin> for @evil_gods;

would be wrong, but

  {pray_to $_} then {sacrifice <$virgin>} for @evil_gods;

would work.  Am I right about this, or does perl 6 let you pass simple
statements as code parameters?  If the former, is there a way to tell it
to do the latter?  

For the record, I was mentally parsing this example as:

  pray_to $_; 
  sacrifice <$virgin> for @evil_gods;

rather than:

  {pray_to $_; sacrifice <$virgin>} for @evil_gods;

The precedence of C<then> isn't very intuitive to me.  

=====
Jonathan "Dataweaver" Lang


                
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

Reply via email to