* Jonathan Scott Duff <[EMAIL PROTECTED]> [05/21/2001 09:39]:
>
> If anything, all variables should have a "value" property that evaluates
> to its, well, value and only that property would be considered in
> conditionals. Then these would be equivalent:
>
> print keys (+$foo).prop;
> print keys $foo.value.prop;
Damn, this is really starting to look like JavaScript, and that's just
plain scary. ;-)
I think we should step back and think: Why would we want these to have
separate spaces? Regardless of the syntax, semantically why would you
want to have separate value/variable properties?
The more I've been thinking about it, it seems that properties should
really just be declared as value-dependent or independent. That is, some
are permanent (compiler hints, types, etc) and others change based on
the value assigned to the var (truth, etc).
# Whatever the syntax is...
module Dog;
property barks { ... } # or "is permanent" ?
property true is value_dependent { ... }
So if you said:
my Dog $spot is true, barks = new Terrier;
$spot = 1;
print "Spot is alive!" if $spot; # prints
print "Spot barks!" if $spot.barks; # prints
$spot = 0;
print "Spot is alive!" if $spot; # DOES NOT print
print "Spot barks!" if $spot.barks; # prints
Really, what you want is some properties to be clobbered by value
assignment, and others to be permanent. That way you get the correct
semantics by just saying:
if ( $spot.true ) { ... }
Instead of the inevitable:
if ( $spot.true || $spot.value.true ) { ... }
If they were kept separate.
-Nate