I am criticizing the Lvalue approach because it does not solve the problem you stated
I didn't offer it as a solution to having a lot of accessors. What I offered as a solution to that
was that the OP re-examine his approach. It would be impossible to suggest anything more specific, because we don't know what the requirements of the task are.
Then I started a new paragraph to address a different issue that the OP wanted to address: that there be a clear syntactic distinction between set and get, so that setting isn't done by mistake. Lvalues do make that distinction clear.
If you do it in your own code - whatever. But please don't recommend to others to use these things too.
I recommend that others look at the various options available to them and make their own decisions. If they find your arguments compelling, that's great. But they shouldn't be browbeaten into following your approach, or Damien's, or mine. It is NOT true that they absolutely must value simplicity of implementation (a lower level of abstraction) over elegance of interface (a higher level of abstraction). That is a trade-off that might have different "right" answers depending on the target user and usage.
Your complaints about "weird hacks" are irrelevant. Those are implementation details, and the user need not be concerned about them. The user is concerned about a usable interface and performance, and sometimes there are trade-offs in one to improve the other.
Caution: Contents may have been coded under pressure.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.