Re: is rw basically a null-op on objects/references?

2005-04-28 Thread Juerd
Ingo Blechschmidt skribis 2005-04-28 14:30 (+0200):
 does the following work as expected?
   for %hash.pairs - $pair { # Note: No is rw!
 $pair.value = ...;   # Modifies %hash
   }

Yes, because a pair is an object (reference), and it's not the .value
that you're passing ro.

I still want -, by the way. 


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html


Re: is rw basically a null-op on objects/references?

2005-04-28 Thread Juerd
Juerd skribis 2005-04-28 14:47 (+0200):
 Yes, because a pair is an object (reference), and it's not the .value
 that you're passing ro.

An example of what would go wrong:

for %hash.pairs.value - $value {
$value = ...;
}

But this will work:

for %hash.pairs.value {
$_ = ...;
}

And this again won't:

for %hash.pairs.value - $_ {
$_ = ...;
}

This makes upgrading a block to use an explicit name a painful
experience if you happen to mutate its value, because you have to
specify 'is rw', which I'm sure will bite many people many times.

This is why I want -, so that the default for

for ... { ... }

can be

for ... - $_ { ... }

rather than the unexpected

for ... - $_ is rw { ... }

so that $_ is the default, and no special default-magic for is rw is
needed. Of course, - $_ and - $_ are 100% equal internally.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html


Re: is rw basically a null-op on objects/references?

2005-04-28 Thread Thomas Sandlaß
Juerd wrote:
Ingo Blechschmidt skribis 2005-04-28 14:30 (+0200):
does the following work as expected?
 for %hash.pairs - $pair { # Note: No is rw!
   $pair.value = ...;   # Modifies %hash
 }

Yes, because a pair is an object (reference), and it's not the .value
that you're passing ro.
I come to the some answer but with a different argument.
Calling the .value method on $pair is not considered a
write operation. And indeed the %hash could arrange for
staying unchanged by having a corresponding copy out
implementation of its .pairs method.

I still want -, by the way. 
Me too. And I guess - naturally completes the set.
Which in turn make me want the parameter traits
'is input' and 'is output'. The former is a synonym
(or replacement?) for 'is const'. Both together form
'is rw' which would be an abbreviation of 'is inputoutput'.
Regards,
--
TSa (Thomas Sandlaß)



Re: is rw basically a null-op on objects/references?

2005-04-28 Thread Juerd
Thomas Sandlaß skribis 2005-04-28 18:09 (+0200):
 I still want -, by the way. 
 Me too. And I guess - naturally completes the set.

Although it would complete the set, in the months since I first started
wanting -, I have not been able to come up with a good reason to want
write-only binding.

A special case of  parsing for - is not a big thing, but adding a
special case for - would be, because the difference between /^-$/ and
/^-.*/ is potentially extremely huge.

(Note that only to the human eye it is a special case, and can look like
, if the parser is smart enough to simply try - as a whole before
trying to match . I wouldn't suggest actually parsing .* first and
then seeing if the .* happened to equal '-' :))


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html