Luke Palmer wrote:

> In Perl 5,
> 
>   my int ($one = 0, $two = 1, $three = 2);
> 
> is a fatal error.  I could argue for this to change, as to support
> better readability (and it would).  It's obvious WIM, so why doesn't
> it DWIM  (disclaimer: cannot be used as an argument for arbitrary
> features. Is not a slogan.  I repeat, is not a slogan.  :)  ?


The problem is that this couldn't work given the current semantics of
the assignment operator.  The "return-value" of an assignment is the
lhs of the assignment, so

  my int ($one = 0, $two = 1, $three = 2);

ends up becoming:

  my int (0,1,2);
  
Which, of course, is a fatal error (partly because it doesn't make any
sense).  This is why stuff like:

  if (defined ($child = fork)) {
  
  }
  
Works as expected.

The point that I am trying to get at is: just because it is obvious
WIM to a human reader doesn't mean that it will be easy for a compiler
to figure out, especially when the rest of the language works a
different way.  List assignment is much easier to read anyways.


Joseph F. Ryan
[EMAIL PROTECTED]

This message was sent using the Webmail System hosted by OARDC Computing Services  -- 
http://webmail.oardc.ohio-state.edu:8080

Reply via email to