Zoran Vasiljevic wrote:
> The Tcl_CloneInterp() is just as simple as:
>
>    walk over the namespaces
>      get all procs/commands
>        copy them to target interp (copy clientData ptr of commands)
>      get all vars
>        copy them to target (sharing instead of deep-copying Tcl_Objs)
>
> and some other small plumbing here/there (errorInfo,
> errorCode, math functions). It is really no rocket science.
>
> The clientData ptr copy is a problem. This is not solvable
> w/o redefining the Tcl command struct to hold the
> clientDataDup call. The sharing instead of deep-copying
> Tcl_Objs is MT-issue which can be solved generally by getting
> the string rep of the Tcl_Obj and copying the string rep only
> but maintaining the object type.

You are correct, that for general purpose use (especially
where threads are involved), Tcl will need to be extended
in some way to allow extensions to be aware of cloning.
This is similar to how Tcl channels need to be extended to
understand the splicing properly between threads.  It is
possible to do, but the core currently lacks it.

> As you see, this is nothing very fancy. Yet, I doubt it will
> be acceptable speedwise, being it in C or not.

This I will disagree with.  If you can handle it all in C,
I think you will save time.  A lot will be in the copying
itself, but saving any and all parsing is a bonus.

Jeff


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to