Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Well pobocks, you're right, I guess having eyes attached to legs is not the best example. But basically I was just trying to exemplify the adding of parts to a body, then accessing those parts in any order with a single $body object instance. The package SOAP::Lite is a perfect example of stacking calls, even though I seldom use that kind of design.

stvn, I think "subclasses" could be the right word, given eyes are a body-part and inherit the 'blood pressure' attribute from the body, even though they could be implemented as inner classes as well. But definitely currying is not what I meant, so I take it back. Anyway, I came to this question while prototyping proof-of-concept code in Moose, starting with object usage in the final code and a simple does-it all class. I was researching a way to represent a DOM-like objects quickly without so many subtypes and with as little keystrokes as possible. I didn't know yet where all the pieces would fall, so I might write the eyes code before I have a head or a leg for that matter.

So this is not about my app design, which I've just started. It's that I really enjoy brainstorming with Moose, so after writing up around 20 lines of candidate has attributes, I saw myself writing another 20 arounds and, as a lazy programmer that I am, I was asking myself if I was missing something, on the lines of:

has 'eyes' => ( is=>'rw', chained=>1, ... ); ## or has 'eyes' => ( is=>'rw', isa=>'Chained[HashRef]' );

I'm glad to hear the Moose team is looking into that. At the end of the road, I'm just trying to replace my old style of prototyping with a big & ugly sub AUTOLOAD { ... } directive with something a little more readable and extensible, just in case the prototype prospers.

In reply to Re: curried-up moose by rodd
in thread curried-up moose by rodd

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



  • 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> <u> <ul>
  • 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 intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-28 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found