Perl: the Markov chain saw | |
PerlMonks |
Re^2: lvalue considered harmful...by adrianh (Chancellor) |
on Dec 14, 2002 at 20:58 UTC ( [id://219893]=note: print w/replies, xml ) | Need Help?? |
One of my favourite languages, Pop-11, does it in quite a nice way. You define a separate subroutine for the lvalue side - known as an updater. For example, a function to access and update the second element of a linked list can be written in Pop-11 like this:
All the advantages of writing separate setter/getter functions without the noise (as I see it) in the function names. In Pop-11 lvalues are poorly named, since they appear on the right! Doing value -> something in Pop-11 is the same as something = value in perl. I find it reads well (something goes into something else) and it also solves that whole "confusing = with ==" problem.
In Section
Meditations
|
|