develooper Front page | perl.perl6.language | Postings from May 2007

Re: explicit line termination with ";": why?

Thread Previous | Thread Next
From:
Larry Wall
Date:
May 15, 2007 12:32
Subject:
Re: explicit line termination with ";": why?
Message ID:
20070515191306.GA23041@wall.org
On Tue, May 15, 2007 at 11:59:35AM -0700, Dave Whipp wrote:
: Jonathan Lang wrote:
: 
: >Close.  I'm thinking "added functionality for semicolon alternatives"
: >rather than the "replace the semicolon" stunt that Semi::Semicolons
: >pulls.  In particular, as long as there's no ambiguity between
: >prefix:<?> and postfix:<?>, I think that it would be quite useful for
: >postfix:<?> to act as a semicolon that additionally sets $_ equal to
: >the expression's value, allowing for a pseudo-Prolog style of syntax
: >(i.e., the code could include questions as well as declarations and
: >instructions).
: 
: A slightly tangental thought: is the behavior of C<given> with no block 
: defined? I.e. is

It would be illegal syntax currently.

: given $foo { when 1 {...} };
: 
: equivalent to
: 
: given $foo;
: when 1 {...};

Both of these suggestions would seem to duplicate the existing construct:

    $_ = $foo;

:-)

Of course, now someone will argue that unary:<=> should assign to $_ by
default, in which case we'd have to find a new interation operator...

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About