Juerd wrote:
> Scott Bronson skribis 2004-07-01 14:11 (-0700):
> > Juerd wrote:
> > > > > pray_to $_ ., then sacrifice <$virgin> for @evil_gods;
>
> I meant it without "then", but apparently forgot to remove it.
>
> pray to $_ ., sacrifice <$virgin> for @evil_gods;
Strictly from a grammatical perspective, I'd be much more comfortable with
C<, then> instead of C<then> as the perl equivelent of the C-style comma:
have the "then" keyword change the preceeding comma from a list
constructor to an expression combiner. From a parsing perspective,
though, this would be a nightmare.
Actually, the whole purpose of the C-style comma is to allow you to place
multiple expressions in a place that's only designed to take one, such as
the various divisions within a loop control set ("loop ($i = 0, $j = 1; $i
< 10; $i++, $j*=2) {...}"). For something like this, you might be better
off doing something like
last($a, $b, $c)
instead of
$a then $b then $c
(where last is a sub that takes a list of arguments, evaluates them one at
a time, and returns the value of the last one). Unfortunately, "last" is
already in use by perl; so you'd have to think up another name for the
sub, such as "final".
If you're really enamoured with the infix operator syntax, consider this
possibility:
sub infix:-> ($before, $after) {
$before; # is this line redundant?
return $after;
}
print $a -> $b -> $c; # prints $c
where C[->] is read as "followed by". You could even set up a
right-to-left version, C[<-], but why bother?
=====
Jonathan "Dataweaver" Lang
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail