in reply to What the [sub]in 'L value do they have?
I mainly agree with the objections to lvalue subs as an OO mechanism. They impose a syntax which exposes the implementation, and they allow direct accesss to data to be exported. As you say, constraint checking is not possible.
The lvalue attribute means that the represented value is modifiable, not just assignable. Consider the following:
What will your visible future foo be in these cases? Your proposals all seem to require that the lvalue sub know a lot about the operators that bind it. It appears that that will produce a very heavy and baroque kind of attribute.{ my $foo = 'boo' . $/; sub foo () : lvalue { $foo } } chomp foo; foo =~ s/o/r/; print foo;
I think that the lvalue attribute should be retained as the overloading mechanism that it is, and its use for exporting data recognized for its own properties. The fact that it is unsuitable for strict OO does not make it useless or harmful.
After Compline,
Zaxo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: What the [sub]in 'L value do they have?
by BrowserUk (Patriarch) on Dec 16, 2002 at 02:02 UTC |