$foo = [$one, $two, $three]; # creates an anonymous list.

$foo = [$object method("foo", "bar")];
This would interpret as 

$foo[0] == $object, etc...

Ilya



-----Original Message-----
From: Buddha Buck [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 11:20 PM
To: Piers Cawley
Cc: Bart Lateur; [EMAIL PROTECTED]
Subject: Re: Curious: -> vs .


Piers Cawley <[EMAIL PROTECTED]> writes:

> Buddha Buck <[EMAIL PROTECTED]> writes:
> 
> > Bart Lateur <[EMAIL PROTECTED]> writes:
> > 
> > > On Wed, 25 Apr 2001 15:52:47 -0600 (MDT), Dan Brian wrote:
> > > So why not
> > > 
> > >   $object!method("foo", "bar");
> > 
> > In my opinion, because it doesn't provide sufficient visual
> > distinction between $object and method().  At a glance, especially on
> > a crowded page, it's similar in appearance to $objectImethod, for
> > instance.  $object.method() has a visual separator (although I'd
> > prefer $object->method()).
> > 
> > How about borrowing from Objective C?
> > 
> >        [$object method("foo", "bar")];
> 
> How do you create an anonymous list now then? Not that I object to
> borrowing from Objective C you realise.

I thought ($one, $two, $three) was an anonymous list.

Seriously, I hadn't considered that their may be a problem with the
syntax I gave.

How would you, under Perl5, interpret the expression I used.  To me,
it looks like a syntax error.  '$object method("foo","bar")' isn't a
valid method call, so it can't be a ref to an anonymous list of one
value.

Other than severe dependence on the comma, is there any reason why we
couldn't have the following?


$foo  = [$one            ];   # array ref
$baz  = [$obj,funcall()  ];   # array ref
$quux = [$one,$two,$three];   # array ref
$bar  = [$obj method()   ];   # method call
$bat  = [$one $two $three];   # syntax error



> 
> -- 
> Piers Cawley
> www.iterative-software.com

Reply via email to