develooper Front page | perl.perl6.language | Postings from February 2005

scoping functions as list operators?

Thread Previous | Thread Next
From:
Stéphane Payrard
Date:
February 24, 2005 18:56
Subject:
scoping functions as list operators?
Message ID:
20050225025606.GC19484@cachan-2-82-67-232-89.fbx.proxad.net

Giving scoping functions the status of list operators
would allow to drop parentheses when not used in conjunction
with initializer so one could write:

  my $a, $b, $c;

instead of

  my ($a, $b, $c);

Most people use scoping functions as the top most function of the
corresponding statement AST so that should not bite unsuspecting
people.  Probably many more people that don't use stricture are
currently caught by the current convention that obliges to parenthesize
when multiple variables are declared.  In a sense, so many people have
been bitten by surprising precedence, that they cargo-cult parentheses
as the list operator.

In my detestation of gratuitous parenthesses, I would additionally
propose a low precedence assignement operator if I could find a good
sign for it.

my $a, $b, $c := 1..3 ;      # too bad := is already taken.
# set? I don't think so.
my $a, $b, $c   set  1..3 ;  # alphabetic like and, or, xor? 
                              # and what precedence relative to them?


-- 
  stef




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