From: Andreas K. <and...@gm...> - 2024-09-24 22:45:07
|
> A few thoughts. > I was not involved in the changes under review, and my first > reaction is that it seems weird for [expr] to convert a value to a > list. Can't say for sure, but I don't think I would pursued this > approach. If it can be reformed as described, that seems good. > That said, I am very strongly of the opinion that Tcl 9 should be > out of the business of protecting the intreps of extensions and > apps. This was never part of the interface contract, and if we can't > escape it in a new major version we never will. The movement from > Tcl 8 to Tcl 9 is the right moment for extensions to pull up their > pants and implement their own intrep preservation properly. Fair point. Back of mind has started churning a bit on how this could be achieved for AKTIVE. Will see how that goes. ... Well, trivial way might be a kind of handle as string-rep, and an internal hash table mapping from handles to values. The int rep would still be a direct pointer to the value, and if that is lost it can be recovered through the handle. More direct might be encoding the pointer, i.e. address into the string rep. No hash table taking memory. Recovery of value is straight decoding the string value. Would need some kind of whitening to avoid giving out actual memory addresses to the script. ... Might have issues with reference counting ... IOW could construct a string referencing an image, and getting the int rep will have to ensure that the RC becomes correct. ... And on the other side shimmering away from the int rep of a Tcl_Obj drops a ref count, might release the int rep ... Yes, regardless of exact implementation of preservation, the ref count / proper life time of the int rep in the face of shimmering is the big gnarly issue to solve. Because on the one hand we want to bind the life time of the <structure> to the life time of all the Tcl_Obj referencing it, yet we also want it to be detached enough to survive shimmering to other int reps long enough to recover when handed back to a command operating on <structure>s. Ok, best to stop here, and let this simmer for quite some time. -- Happy Tcling, Andreas Kupries <and...@gm...> <https://core.tcl-lang.org/akupries/> <https://akupries.tclers.tk/> Developer @ SUSE Software Solutions Germany GmbH ------------------------------------------------------------------------------- |