> Other than Ruby, are there any languages that support syntax like "object->method = value"?

Python does via so called properties. But I don't know any implementation or performance details.

This way simple attributes can be easily turned into mutators without any need to change the API.

> I'm definitely not a fan of lvalue subs or tie.

OK, it seems overcomplicated to do it this way. But IMHO it's stable, has no side-effects and can be hidden behind a nice syntax. It's just slow!

Look, I don't know every archive discussion, so I'm relying on PBP. ... But the reasoning "Don't use lvalue-attributes because you will be forced to use tie afterwards and we showed you earlier that tie is evil" is shallow.

All "earlier arguments" against tie in PBP do not apply with lvalues, except the slowness!

So tuning up tie would solve the whole thing. I mean an alternativ static version hooking wrapper-method directly to variables.

Or does anyone have a good example, where tie profited from resolving methods dynamically and having inheritance and overload and the other OO stuff?

Cheers LanX


In reply to Re^4: A tale about accessors, lvalues and ties by LanX
in thread A tale about accessors, lvalues and ties by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.