HaloO,
John M. Dlugosz wrote:
I have similar thoughts. I'm thinking that some macros will aid in
writing proper setters via a tie-like mechanism that don't require any
core language changes, so it's not a real problem. That is, a reusable
proxy class that you can construct to run the setter body code, and
package it up so you write it like a method.
If I get you write, you want some magic to convert
$obj.attr = 42;
into
$obj.attr(42);
so that one can write the attr method as if it had a single
parameter without actually doing so. E.g.
class Blah
{
method attr is setter
{
self.blahh = rhs; # rhs gives 42 above
}
# magically same as
# method attr ($rhs)
# {
# self.blahh = $rhs;
# }
}
I wonder if that couldn't simply be
method attr is rw
{
return self.blahh;
}
Or am I missing something?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan