--- Michael Lazzaro <[EMAIL PROTECTED]> wrote:
>
> On Sunday, January 19, 2003, at 09:51 PM, Luke Palmer wrote:
> >> From: "Sean O'Rourke" <[EMAIL PROTECTED]>
> >> On Sat, 18 Jan 2003, Michael Lazzaro wrote:
> >>> So 'if' and friends are just (native) subroutines with prototypes
>
> >>> like:
> >> IIRC it's not that pretty, unfortunately, if you want to support
> this:
> > That is not a problem:
> <snipped>
>
> Yeah, a three-argument form would easily allow chaining. But of
> course
> it still doesn't do the appropriate syntax checking (C<else> outside
> of
> C<if>, etc.). (It's only speculation on our part, of course, but
> Damian's response was quite intriguing -- he seemed to imply they had
> a
> solution that would work.)
I'm not sure that there *IS* much appropriate syntax checking, but you
could (and, I suspect, MUST) easily implement this by constructing
reference objects. (There has to be some kind of stack...)
But consider:
print "foo" if ($bar);
print "baz" else;
*What about THAT, Mr. Fong?*
This looks to me like an infix operator, or a postfix one for else.
Also, the case of C<if> versus C<if-els...> is generally a
"separable-verb" problem:
log $user onto $system.
log $message to $stderr.
l2x = log 2 * log $x; # Don't check my math, please. :-)
Is it worth handling this?
sub log($n) { ... }
sub log _ onto($user; &_ ; $machine) { ... }
sub log _ to($message; &_ ; $stream) { ... }
=Austin