[Openmcl-devel] [Sbcl-devel] CLOS make-instance :around behaviour

Brian Mastenbrook brian at mastenbrook.net
Sun Oct 19 14:11:46 PDT 2008


On Oct 19, 2008, at 4:07 PM, Bob Hutchison wrote:

>> Are you sure that you need such caching? Garbage collectors are
>> nowadays pretty good at recycling short-lived objects, so that you
>> shouldn't need this for performance purposes - unless this is about
>> semantics and not performance...
>
> It's semantics I'm afraid. A simple situation is where there is a
> cycle of objects -- only the id of the object is available to identify
> that an object exists twice.


Then I'd suggest using a function with a different name, as changing  
make-instance in this way would violate the standard, and shadowing it  
will probably be confusing for users who expect make-instance to act  
like cl:make-instance. From the HyperSpec:

"The generic function make-instance creates and returns a new instance  
of the given class."

If you're not always creating a new instance, I'd suggest something  
like "intern-instance".
--
Brian Mastenbrook
brian at mastenbrook.net
http://brian.mastenbrook.net/




More information about the Openmcl-devel mailing list