q{ But... isn't that a "surprise"? }. This is a fair point, but it's only a surprise if the user of my class expects a hash based implementation (the docs will soon correct this faulty guess ^_^).

In the case where he looks into my hash, he has decided to play with the underlying implementation details of my class and that's none of his buisness. It means I can't change how my classes work without breaking his client code, it also ties his code far tighter to my class and it's implementation, so he wont be able to later (painlessly) change to f00li5h::XS to gain the speed improvements it offers, or f00li5h::POE::Plugin to gain the cool poeness. Also, I may not be able to maintain a hash based interface when writing these new versions, so they may just never happen.

At very minimum, letting people play with your hash innards is using variables in your API, and that's frowned upon.

Although tricks with tie can allow my code to look like it's based on a hash, when it's not (kyle's Make an inside-out object look hash-based using overload.), but that's really best for porting, not for long term use...

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

In reply to Re^9: Method Chaining and Accessors by f00li5h
in thread Method Chaining and Accessors by linenoise

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.