On Tue, Feb 15, 2005 at 07:20:53PM -0600, Jonathan Scott Duff wrote:
> > Patrick R. Michaud wrote:
> > >OTOH, what happens with...?
> > >
> > >   sub nofun($x is rw) {
> > >       $x += 2;
> > >   }
> > >
> > >   $y = 3 | 4;
> > >   nofun($y);
> 
> That's either an error ("Can't modify constant") or the same as 5|6.
> The former makes the most sense to me at the moment.

Hmm.  $y is definitely not constant -- that's how I was able to do
the assignment in the first place.  And "is rw" certainly doesn't
sound like "constant" to me.  :-)  I guess it's going to be 5|6 --
what happens is that the autothreading of nofun() is really
passing the references to $y's individual elements, just like any
other subroutine call passes references, and those individual
elements are modified in place, just like any other subroutine call
with "is rw" parameters.

So, things are still consistent.  :-)

Pm

Reply via email to