Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I won't bother commenting on your "all OO code is doing it wrong" rant as you and I have already been down that road many times and we will never agree and so it is not worth going down it again.

However, there is maybe some merit in my suggesting that Moose might also allow one or more compile-time switches to disable the creation/costs of the methods and data required to provide for deep introspection, for those classes that do not use it?

There is a lot of work going on to do exactly this. The idea is to basically "compile" the metaclasses and accessors once and cache them (the exact details of how that is accomplished is still up in the air). This would remove much of the Moose startup penalty and memory cost involved with metaclasses and would open the doors for other possible optimizations. I doubt though that we could replace method access with direct hash access since that involves compiling the call site and not the class itself and that can get really hairy really quickly.

As for your idea that type/range checking is only useful during development, I disagree (SHOCKING ISN'T IT!). In languages like O'Caml, the compiler does sophisticated static analysis/type inference to make sure that type usage is consistent throughout the program. Because of this O'Caml can ditch all type information at runtime, which helps to contribute to it's very fast runtime performance. Doing such a thing with a dynamic language like Perl where static code analysis is all but impossible would be a bad idea. It would be like not checking your parachute before jumping from an airplane because last time you jumped everything worked just fine.

-stvn

In reply to Re^7: OO automatic accessor generation by stvn
in thread OO automatic accessor generation by Neighbour

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 pondering the Monastery: (2)
As of 2024-04-20 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found