It should be possible to do class invariants one way or another. Perhaps we could just say that any PRE and POST properties on the class itself automagically get attached to any methods defined in the class.
As for naming conflicts, A12 does talk about that some in the context of Roles, but similar reasoning applies to inherited methods. In general, renaming violates Liskov substitutability, so we discourage (but do not prevent) that approach in favor of distinguishing via multiple dispatch where possible, and use of a switch method where not. But in cases where renaming is used, it'll be important to make sure the correct PRE and POST are called at each level. If renaming is done simply by a wrapper method in the derived class, this will happen automatically, I suspect.
Nonetheless, if you're changing the contract of a class,
you probably ought to consider delegation instead of inheritance. And the delegation mechanism certainly has plenty of hooks for renaming.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||