Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Generic object in inside-out classes

by xdg (Monsignor)
on Feb 11, 2007 at 13:31 UTC ( [id://599458]=note: print w/replies, xml ) Need Help??


in reply to Generic object in inside-out classes

That's an interesting technique -- I'm definitely adding it to my notes for the next time I give my inside-out objects talk.

One negative that I see is that it adds even more overhead to every property access -- instead of id being an alias to refaddr, this approach has a second function call and a comparison.

That means I'd never want to implement this unless it was really necessary. I certainly wouldn't use it for convenience to specify initializing values -- that's a high runtime cost for a one-time activity.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Replies are listed 'Best First'.
Re^2: Generic object in inside-out classes
by Anno (Deacon) on Feb 11, 2007 at 13:57 UTC
    Scalar::Util could provide an id() function (say) with the variant behavior implemented in XS. That would reduce the overhead to nil.

    Alternatively, perl 5.10 will have Hash::Util::FieldHash to support inside-out classes. A class based on that will allow generic objects.

    Anno

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://599458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-16 05:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found