ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] [Tcl9-cloverfield] Cloverfield references (was Re: Variable access)
by Alexandre Ferrieux other posts by this author
May 22 2008 4:45AM messages near this date
Re: [TCLCORE] Cloverfield references (was Re: Variable access) | Re: [TCLCORE] Cloverfield references (was Re: Variable access)
On 5/21/08, Larry McVoy <lm@[...].com>  wrote:
>  > My goal with Cloverfield is to keep the existing Tcl semantics
>  > (copy-on-write, pass-by-value) while adding references. This implies
>  > that the string rep of a structure holding references may change over
>  > time. This would be grossly inefficient if the whole string rep had to
>  > be recreated over and over again, especially for large structures, so we
>  > need an efficient string representation that allows for selective
>  > invalidation of substrings.
> 
>  Is this really true?  It seems to me it is only true for things wanting
>  to get at the string rep.  And yes, you want to be able to puts($obj)
>  but if all the code you are calling is compiled and knows how to get
>  at the internals isn't that a have-your-cake-and-eat-it-too?

I concur with Larry. See my attempts with the Mutability patch earlier
this year, and also a (long) thread on clt exploring different options
for this:

http://groups.google.com/group/comp.lang.tcl/tree/browse_frm/thread/b6c26a33f5ebd3e0/b9e4201
c7c7c6c6c?hl=en&rnum=101&q=fredderic+ferrieux&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2F
thread%2Fb6c26a33f5ebd3e0%2Fb94505c1f6b335db%3Fhl%3Den%26lnk%3Dgst%26q%3Dfredderic%2Bferrieu
x%26#doc_b9e4201c7c7c6c6c

Basically, two approaches were imagined:

  (a) keep track of back references (from containee to container) and
invalidate string reps "up the container hierarchy" when a mutable
object has been updated.

  (b) keep a list of mutable objects whose string rep has been
computed, and mass-invalidate them when any time a mutable is poked
into.

Only (b) was implemented in my stillborn patch (you can imagine why).
But, as Larry suggest, unless you stuff your code with [puts], the
performance hit of mass invalidation is fairly small in practice.

Notice that this was done within true Tcl, where string reps are true
strings, not ropes. Of course the efficiency trade-off is between:

   - late rope-to-string (Cloverfield): no mutability overhead, but no
cacheing of the linearized string of a rope.

   - string rep caching (Tcl): variable mutability overhead (a,b), but
full cacheing of string reps until invalidated.

Do you agree with this summary ? Do you see alternatives ?

-Alex

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
fbonnet
fredericbonnet
Neil Madden
fbonnet
Neil Madden
fbonnet
Lars Hellstrom
fbonnet
Neil Madden
fredericbonnet
David Welton
fbonnet
David Welton
Larry McVoy
Alexandre Ferrieux
Andreas Leitgeb
fbonnet
Neil Madden
Donal K. Fellows
Alexandre Ferrieux
Larry McVoy
Neil Madden
Gustaf Neumann
Neil Madden
Larry McVoy
Neil Madden
Alexandre Ferrieux
fbonnet
Neil Madden
Alexandre Ferrieux
Donal K. Fellows
Larry McVoy
Alexandre Ferrieux
Donal K. Fellows
Alexandre Ferrieux

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved