On Sun, Feb 04, 2001 at 05:30:59PM +0100, Johan Vromans wrote:
> James Mastros <[EMAIL PROTECTED]> writes:
> > And I always hated that about VB and Pascal -- you can assign to the magic
> > variable, but can't modify it.
> 
> That was before the invention of auto-assignment operators. In the
> 70s, Burroughs Extended Algol did it this way. So it would be
> perfectly okay to write
> 
>   sub foo {
>     foo = ...;
>     ...;
>     foo += 5;
>   }

Right, but you can't do 
sub foo {
   foo = ...;
   ...;
   if (foo == 42) {
      foo=12;
   }
}

Mind you, I'm not saying that it's a Bad Thing to offer it, I'm just saying
that /I/ wouldn't use it.  TWMWTDI, though.

The $__ option seems a lot better to me, because there's no syntatical
reason against self-reference.  ($^R for return might be a better name --
unless we've already used that for somthing else.  Nope.)

Oh, here's an idea WRT extending the concept to cover both scalar and list
assignment:  Have $^R be the return in scalar context, and @^R be the return
in list context.  If @^R is unset, then a one-element list of $^R is returned.

     -=- James Mastros
-- 
"My country 'tis of thee, of y'all i'm rappin'!  Lan where my brothers
fought, land where our King was shot -- from every building top, let freedom
happen!"
        -=- Monique, Sinfest[.net]
AIM: theorbtwo       homepage: http://www.rtweb.net/theorb/

Reply via email to