From: Duquette, W. H (393K) <wil...@jp...> - 2015-07-28 20:15:38
|
-- Will Duquette -- Wil...@jp... Athena Development Lead -- Jet Propulsion Laboratory "It's amazing what you can do with the right tools." On 7/28/15 7:07 AM, "Donal K. Fellows" <don...@ma...> wrote: >On 28/07/2015 13:28, Cyan Ogilvie wrote: >> I've used a variant on this approach for about 10 years and it's stood >> up well in production environments, but something closer to actual value >> semantics would be nice. I've thought about implementing a custom >> Tcl_Obj type, but that really feels like abuse, and it's tricky to >> define a string rep that is efficient. > >I've been thinking about doing a garbage-collection scheme for TclOO, to >be only turned on for objects created with the 'new' method. (I suppose >it could even be put in a metaclass, so that existing objects wouldn't >have the problem.) The idea would be to track when there cease to be any >Tcl_Obj references to the object, and delete it when they're gone. >Formally not great ‹ it's not how any ³proper² current value semantics >work, though it is close to what JTcl and tcom do ‹ but would work in >practice (and would support the ³use as a value² style quite naturally). This would scratch part of my itch pretty well: it would be possible to return objects with methods from a proc and not worry about having to dispose of them. Will > >Doing it would require some small core changes in the main command >dispatch, as that currently forces values to be of a particular >Tcl_ObjType that doesn't (so far as I know) support useful deletion >callback semantics. Otherwise it would be pretty much self-contained. > >Alternatively, TOOT <URL:http://wiki.tcl.tk/11543> by Neil Madden. > >Donal. > > >-------------------------------------------------------------------------- >---- >_______________________________________________ >Tcl-Core mailing list >Tcl...@li... >https://lists.sourceforge.net/lists/listinfo/tcl-core |