Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Re: What the [sub]in 'L value do they have?by BrowserUk (Patriarch) |
on Dec 16, 2002 at 02:02 UTC ( [id://220100]=note: print w/replies, xml ) | Need Help?? |
Given the way :lvalue works now, I came to the same conclusion, but then I set about trying to understand what uses it did have, procedural code or otherwise and I came up empty. For a good, practical use anyway, but the documentation is sparse to put it mildy, which is why I decided to move my questions and thoughts away from the original thread. The fact that I can modify the original entity directly through an lvalue sub may be an optimisation, but I don't see substr($foo, 3, 2) = 'fred'; as intrinsically different from substr($foo, 3, 2, 'fred'); I had never thought of doing nor encountered anything that did:
And that does have some interesting possibilities and is exactly the sort answer I was looking for. I'd like to see a real use for it and the benefits thereof described, but in the absence, you've given me a new way to look at a facility of perl that I long been intrigued by but have singularly failed to find a good use for. That said, I still like the syntactic possibility of lvalue assignment for mutators and the only thing stopping that is the exposure of information that the compiler/interpreter has available to it. As I can see at least two ways of making that information available that would not affect its current usage in anyway, and would not break any existing code, I wonder if this would be such a hard thing to do and what objections there could be to doing it? Like many features of perl, noone would be forced to use it, but it would give those that would like to (Ie. ME:^) another way to do things. Examine what is said, not who speaks.
In Section
Meditations
|
|