If you only want to curry some of the methods into subs, you can always fall back on function currying, the syntax of which is run-time-ish, so how you pick the functions to curry and how you then bind the new functions to names is external to the curry itself. It would still be possible to hook this into the "use" apparatus, since that has built-in the notion that it is constructing a view of something elsewhere, so a module that you think of as Foo can be a version of Bar with all the names and arguments messed around with.
As for having to repeat the class name, yes, that's currently an issue, particularly since you have to declare the type of your $defobj before the use. But I think I mentioned the current syntax is still negotiable, and would certainly be open to suggestions for syntax that is both composable and succinct. We could go as far as to have a variant usesingle that autocurries a singleton, but then we have to decide how it composes with the filters you also requested above, and where the singleton object ends up getting stored, if it's to have some kind of user-accessible name. For composability there are times you might want to return the singleton, and times you might want to return the class's protoobject. It's difficult to do both of those simultaneously.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.