Stephen, this is what I got on Tcl core:
Begin forwarded message:
From: miguel sofer <[EMAIL PROTECTED]>
Date: 7. Oktober 2006 16:30:05 MESZ
To: Zoran Vasiljevic <[EMAIL PROTECTED]>
Cc: miguel <[EMAIL PROTECTED]>, Tcl List Core <tcl-
[EMAIL PROTECTED]>
Subject: Re: [TCLCORE] Lifetime of a literal object
Reply-To: [EMAIL PROTECTED]
Zoran Vasiljevic wrote:
On 07.10.2006, at 16:05, Zoran Vasiljevic wrote:
Ah... that's what I was afaid of...
Actually, I wanted to use tne internal rep of that object to
store (or better cache) some expensivley calculated value.
I was hoping to have this object "alive" for the time my
predure is defined at least or (better) until the interp
which house it is destroyed.
To be more precise, I wanted to cheat...
Consider:
proc foo args {
puts baz
cache baz
return
}
proc humpty args {
puts dumpty
cache dumpty
return
}
Now the [cache] above is my hypothetical command
which calculates some arbitrary value and splices
it in the object internal rep but w/o invalidating
its string rep.
It does that ONLY if the current internal rep of the
(literal) object does not already contain precalculated
value.
What I hope to achieve with that is: only the first time
when I call the procedure my [cache] will actually have
to do the calculation. All other invocations will use
pre-calculated value stored in the "baz" or "dumpty"
literals.
So this way I could "re-use" literals as poor man's cache.
Would that work?
For a while ... but I wouldn't. Such a misuse of Tcl_Objs and EIAS may
lead to weird bugs.
I encourage you to talk with Jean-Claude Wippler about these issues;
he's been looking for workarounds for ages. If you guys do find a good
way to do things, share it!
Refs that may be interesting:
http://aspn.activestate.com/ASPN/Mail/Message/3168511
https://sourceforge.net/tracker/index.php?
func=detail&aid=1512138&group_id=10894&atid=360894
http://aspn.activestate.com/ASPN/Mail/Message/tcl-core/3168677
----------------------------------------------------------------------
---
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to
share your
opinions on IT & business topics through brief surveys -- and earn
cash
http://www.techsay.com/default.php?
page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tcl-Core mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tcl-core