On Fri, Feb 16, 2001 at 12:32:01AM +0100, [EMAIL PROTECTED] wrote:
> On Thu, Feb 15, 2001 at 03:07:51PM -0800, Edward Peschko wrote:
> > 
> > > Also, if I have:
> > > 
> > >     @a = (1 .. 10);
> > >     $a, $b, $c = @_;
> > 
> > How about 'an implicit parens around a set of statements separated by commas
> > in any context'? This is consistent
> > 
> > $a, $b, $c = $d, $e, $f; # ($a, $b, $c) = ($d, $e, $f);
> 
> Do you mean:
> 
>   (($a, $b), $c) = (($d, $e), $f);
> 
> perhaps? 

No, actually not. I mean to add the parens by determination of 
'list operators', things like '='. I would discourage ',' in its use
as a statement separator, and replace it with ';'. And I'd like
to be able to say:

while ($content = &$collector; length($content))
{

}

or even

while { $content = &$collector; return(length($content)) }
{

}

although that does look sort of funky.

> So, the cost of leaving off parens at some places, is to add them elsewhere?
> 
> What's the point? In the long run, you aren't gaining anything, all you
> are doing is messing up the precedence table. It's already complicated
> enough, why have a different precendence table in perl6? Fine, you might
> not need the parens for my(), you suddenly need them where you don't need
> them in perl5.

Well, I just analyzed this empirically. I went through a rather large module
(libwww) to analyze how much impact the changes that I'd propose would make,
in a real-life setting, and how many parens you would lose/gain in-toto:

The pattern:

my(...) = @_;

appears 116 times.

The pattern:

($x1,$y1,$z1) = ($x2, $y2, $z2);

or 

while (($a1,$b1) = each (%suffixType))

appears approx 25 times.

With just these two types of items you could lose 143 pairs of parenthesis 
minimum. Add on extra sundry things, and you lose 50 more paren pairs. If you 
went for broke, you could probably lose lots more than this

Now, as for the things this breaks:

There were 3 things that broke outright, all statements that were:

  while ($content = &$collector, length $$content) {

Additionally, there were some statements that looked like:

$VERSION = sprintf("%d.%02d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/);

which I don't think break because the operator in question (=~) only
works against scalars..

So that's 3 statements out of 9000 lines of code. But then again, I only did
a rough analysis, you are welcome to check it over.

> > tie (my $shoe) => $string;
> 
> Not enough arguments for tie...
> 
> This trap is documented.

I guess then I don't understand what:

tie my $shoe => $string

is supposed to do... I count either one or two arguments here, depending
on how I parse it.
> 
> > both of these look easier to follow to me, at least.
> 
> You're kidding, right? If I wanted LISP, I know where to find it.

no, I'm not. And anyways, this solution is far less lispish than what
you are suggesting:

my $a, $b, $c = @_

vs 

my ($a, $b, $c) = @_;

while $key, $value = each %hash

vs

while ($key, $value = each %hash)

vs

while (($key, $value) = each %hash)

> I think I've seen enough of perl6 by now. I'll treasure my copy of perl5
> till the end of times.

you are welcome to do that. Its called 'use perl5' at the top of your
script.

Ed

Reply via email to