At 08.53 +0100 01-05-22, Graham Barr wrote:
>With the current approach I can see most code accessing properties
>with $var.prop{name}
>because they want to make sure they get the property and not a method, whereas
>it would be shorter, in the common case, to have something like $var'name
I would write $var.name and simply not define a prop method if I
didn't want one.
Other than that, I think I like Larry's idea to have one variable_is
and one value_is method. I would also very much have Data::Dumper
built in as 'dump', so that I could say
print dump $var;
and get a complete printout of value, variable properties and value
properties of the $var variable. (And not a core dump, as I would get
in Perl 5.)
Tangentially, would it be possible to have
dump $var;
in void context automatically call print (or warn (or carp)), while
it in scalar context returns what it in void context would have
printed?
Regarding deleting properties, I don't see a need for deleting
variable properties, and value properties die when we replace a value
with a new one. To get rid of all properties while preserving the
value, one could do something like:
$var = $var.value
To delete a single run-time property, we could reuse the existing
'delete' keyword, that deletes hash elements:
delete $var.name;
These thougts are just my $0.02. I'm sure Damian and Larry have
thought this out in much more detail.
Cajo.
--
Carl Johan Berglund, [EMAIL PROTECTED], 0708-136 236
Adverb Information, http://www.adverb.se, 08-555 788 80