Wouldn't it be nice if you could do:
class Foo {
...
&{intern('{}')} := method ($self: $key) is lvalue {
...
}
}
So, later, you could do:
$obj = Foo.new;
$obj{something} = $something_else;
ie, overriding hash lookups, array lookups, whatever. (I'm using a
Lispish 'intern' here to return a symbol from a string by the way, I
doubt it's a good 'real' syntax, but I'm not at all keen on C<sub '{}'
{...}>
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?