| Store | Cart

Re: [TCLCORE] Tcl Objects with value semantics

From: Duquette, William H (393K) <will...@jpl.nasa.gov>
Tue, 28 Jul 2015 20:15:28 +0000
--
Will Duquette -- Will...@jpl.nasa.gov
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" <dona...@manchester.ac.uk>
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-...@lists.sourceforge.net>https://lists.sourceforge.net/lists/listinfo/tcl-core


------------------------------------------------------------------------------
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core

Recent Messages in this Thread
Duquette, William H (393K) Jul 27, 2015 07:56 pm
Peter S Jul 28, 2015 12:07 pm
Duquette, William H (393K) Jul 28, 2015 03:23 pm
Cyan Ogilvie Jul 28, 2015 12:28 pm
Donal K. Fellows Jul 28, 2015 02:07 pm
Duquette, William H (393K) Jul 28, 2015 08:15 pm
Messages in this thread