View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] results of the poll

From: Zoran Vasiljevic <zoran_at_archiware.com>
Date: Sun, 10 Mar 2002 13:18:23 +0100

Bugs in 0.9.3 and 0.9.4 for threaded (including AOLserver) builds.
The problem is that in Tcl, a strong marriage between the
Tcl interpreter and its accompaniyg thread exists.

Each time a new Tcl thread is starting, it may (AOLserver will!)
load the XOTcl_Init routine. This will patch couple of the
standard Tcl commands using the TclCommands function.
This function had an internal static counter, tracking
number of calls. On thread exit, this procedure was called
again and it did a reverse, replacing patched pointers with
original ones.


TclCommands(Tcl_Interp* in, int load) {
  int rc = TCL_OK;
  if (load) {
#ifdef USE_TCL_STUBS
    rc|= XOTclReplaceCommand(in, EXPR, 0, 0);
    rc|= XOTclReplaceCommand(in, INCR, 0, 0);
#endif
    rc|= XOTclReplaceCommand(in, SUBST, 0, SUBST_CMD);
    rc|= XOTclReplaceCommand(in, INFO, XOTcl_InfoObjCmd, 0);
    rc|= XOTclReplaceCommand(in, RENAME, XOTcl_RenameObjCmd, 0);
    rc|= XOTclReplaceCommand(in, UPLEVEL, XOTcl_UplevelObjCmd, 0);
    rc|= XOTclReplaceCommand(in, UPVAR, XOTcl_UpvarObjCmd, 0);
  } else {
    rc|= XOTclReplaceCommandCleanup(in, INFO);
    rc|= XOTclReplaceCommandCleanup(in, RENAME);
    rc|= XOTclReplaceCommandCleanup(in, UPLEVEL);
    rc|= XOTclReplaceCommandCleanup(in, UPVAR);
  }
  return rc;
}

>
> the results of the poll can be summarized as follows:
> - most people favored "names" instead of "symbols"
> for "selfDispatch"
> - the hottest favorite is "my". One can write now
>
> ...
> my instvar a b c
> my log
> ...
>
> instead of
> ...
> [self] instvar a b c
> [self] log
> ...
>
> the variant with [self] will continue to work
> forever..
> If someone is not happy with "my", please react
> soon.
>
> From the "volatile" front: we have now more-or-less Zoran
> suggestion implemented in C. Actually there is no need
> in general for using tcl-variables to implement volatile
> objects (we could handle this on a pop of stack frames),
> but at least for pure tcl-procs, var traces are the simplest
> implementation. The current implementation (purely in C)
> works as part of the "new" method:
>
> a) Object new ...
> b) Object new -childof ...
> c) Object new -volatile ...
> d) Object new -volatile -childof ...
>
> (a) creates "global" objects, not in the global
> namespace anymore, but in xotcl. (b) can be used
> to create objects as child of other objects (e.g. [self],
> the objects are deleted, when the specified object is deleted),
> (c) are "global" objects as in (a), but they are deleted,
> when the current tcl-proc/object-proc/instproc is left,
> and (d) is a combination of b and c.
>
> Needless to say, a-d works for classes as well as e.g.
>
> Class new -volatile
>
> in order to create "anonymoes" classes. The implementation
> of new is slightly faster than before, since i changed the
> nameing schema to be the same for all kind new ("__#122", ...),
> such that e.g.
> [Class new -volatile] new -volatile
> works as well. the disadvantage is that the neat
> classname derived names as in earlier versions have
> to be done by hand now...
>
> that was it for now
>
> best regrads
> -gustaf
> _______________________________________________
> Xotcl mailing list - Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl