Version 0 of scrobj

Updated 2008-12-30 00:14:27 by CN

What: scrobj - scripted Tcl_Objects

 Where: http://nullhomotopie.de/programs/scrobj-page.html
 Description: a Tcl extension that allows you to implement new Tcl_Object types from the script level.
 Updated: 12/2008
 Version: 1.0

Quote from the man page:

       Tcl's fundamental mantra says that "everything is a string" and much of
       Tcl's simplicity derives from this rule. Strings  can,  however,  carry
       with  them an internal representation as some other data type, and this
       is one reason for Tcl's  astonishing  performance.   For  example,  Tcl
       maintains  such  an  internal representation for integers, lists, byte-
       codes, and many other types.

       Extension writers have long been able to add  new  custom  types  using
       Tcl's  C  interface.  The scrobj package allows you to do the same from
       the script level.

       Unfortunately, in order to achieve this the package has  to  violate  a
       basic  assumption  of Tcl's bytecode engine, namely that it is not get-
       ting invoked recursively from a call to Tcl_GetString.   A  consequence
       is that scrobj can be used to crash the application, although this does
       require a rather contrived setup.

       To prevent such crashes in the legitimate cases the package uses a ded-
       icated  Tcl interpreter for every registered type. Both Tcl 8.5 and Tcl
       8.6 seem to tolerate recursive invocations of the bytecode  engine,  as
       long as they execute in different interpreters.

The package also contains two sample applications that implement a little "expr" command for arithmetic with rational numbers.


[ Category Package ]