At 09:21 AM 8/17/00 -0700, Nathan Wiger wrote:


>    $cgi->param($var, @val);      # traditional
>    $cgi->param($var) = @val;     # lvalue, but same thing
>
>The second one, then, just makes it more obvious what's going on. But it
>shouldn't change the behavior of the sub. In fact, these two should
>*both* be valid options for setting $var. Then the programmer can choose
>their preferred style.

OK, this is where we differ.  I see no reason why those two should 
necessarily be the same.  Why couldn't the first be a normal function 
(returning an rvalue) rather than an assignment?

Or, more concretely, given:

$tree->path('L','R','R');

which is the "correct" interpretation?

1) return the subtree rooted on the right child of the right child of the 
left child of root; or

2) set the right child of the left child of root to the scalar value 'R'

To me, it's "clear" that the first version is properly written as:

$tree->path('L','R','R');

and the second as:

$tree->path('L','R')='R';

I don't mind if a programmer would choose to support $p->foo(@args,$val); 
over $p->foo(@args)=$val;  I don't even mind if a programmer chose to 
support both.  But the programmer should have the choice of making them 
mean different things, if that's what the problem domain calls for.

>-Nate

Reply via email to