Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Encapsulation through stringification - a variation on flyweight objects

by Abigail-II (Bishop)
on Apr 01, 2003 at 22:27 UTC ( [id://247371]=note: print w/replies, xml ) Need Help??


in reply to Encapsulation through stringification - a variation on flyweight objects

That's what I am already doing with Inside-Out objects.

There are some problems though. First, you have a memory leak. If an object goes out of scope, you aren't cleaning up the attributes. To do so, write a DESTROY function (just like with Inside-Out objects). Second, you'll get a problem if you want to overload stringification.

Abigail

Replies are listed 'Best First'.
Re: Re: Encapsulation through stringification - a variation on flyweight objects
by robartes (Priest) on Apr 01, 2003 at 22:37 UTC
    I thought it would be a bit too much to have been the first to think of this <g>. I had super searched but not on 'Inside-Out objects'.

    I know about the memory leak, I have not included a DESTROY method as this was just an example (the same reason I have not included any accessors, or attribute validation). It's still a valid point though.

    Stringification overload is indeed problematic. One hole poked ;).

    Thx for the comment.

    CU
    Robartes-

      BTW, you can overload stringification /or/ numification just fine, but not both.


      Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-03-28 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found