home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / tcl / 1204 < prev    next >
Encoding:
Text File  |  1992-08-16  |  6.1 KB  |  107 lines

  1. Organization: Carnegie Mellon, Pittsburgh, PA
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!udel!rochester!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!<UNAUTHENTICATED>+
  3. Newsgroups: comp.lang.tcl
  4. Message-ID: <oeXnHi_00h5KN7apZr@cs.cmu.edu>
  5. Date: Mon, 17 Aug 1992 01:11:10 -0400 
  6. From: Sean.Levy@cs.cmu.edu
  7. Subject: Why tcl scales just fine if you put something on top of it
  8. Lines: 97
  9.  
  10. [I originally sent this as email to Dan Conolly@Convex in re his
  11. original message. As I've seen a couple more messages in the thread on
  12. the group, I thought I'd post it and stand the inevitable flames. This
  13. is actually two messages cat'ed. Yes, since I wrote BOS I'm of course
  14. more comfortable with it than anyone else (Hi, Colas! :-), but I do
  15. think there is a more generic point to be made that just "use my neat
  16. thing and all your problems will be solved". Of course, if you *do* use
  17. my neat thing all your problems *will* be solved, but that is another
  18. matter... :-)*10 --S]
  19.  
  20. Check out BOS - The Basic Object System. It's a C-callable library that
  21. implements the notion of object and which uses Tcl as its interpreter
  22. for interpreted methods (you can have "compiled" methods in C, and mix
  23. compiled and interpreted methods in the same object, plus lots more
  24. stuff). I regularly (a) subclass and (b) mixin existing objects using
  25. BOS to extend, among other things, the set of tk widgets (I have all tk
  26. widgets wrapped with BOS "classes"). BOS is a class-free object system,
  27. also called a prototype-based object system; it is modeled loosely on
  28. the Self system from Stanford. It solves most of the problems you
  29. brought up in your message, I believe. I'm working on a compiler for BOS
  30. that will translate interpreted methods into C code, which should solve
  31. the rest of them.
  32.  
  33. BOS 1.31 is available from the tcl archive at barkley, and via anonymous
  34. FTP to sambar.ndim.edrc.cmu.edu (128.2.214.236) under
  35. /afs/cs/user/snl/public/bos-1.31.tar.Z. There isn't a whole lot of
  36. example code yet, and the makefile will need some tweaking on your
  37. system, but it is small, easy to understand, and 90% of the exported
  38. interface is documented (the 10% that isn't is new as of 1.31 and will
  39. get man pages and other docs Real Soon).
  40.  
  41. BTW, I spent quite a bit of time playing with lisp-based extension
  42. languages and building software in lisp environments in general (all the
  43. way from MACLISP on the ITS boxes at MIT and the Symbolics to SIOD and
  44. Allegro), and am now thoroughly convinced that lightweight, easily
  45. embeddable languages like tcl and hybrid environments that mix C,
  46. fortran, and other compiled languages with such interpreted ones are the
  47. way to go. Managing separate heaps for lisp and C, dealing with the
  48. realities of unix environments and other basic problems prevent common
  49. lisp from really being able to provide what is needed on a
  50. lowest-common-denominator basis, for a number of reasons, not all of the
  51. techinical. I am building a very major piece of software using BOS/tcl,
  52. and find it just the right blend. Of course, everyone's mileage will
  53. vary...
  54.  
  55. If you do pick up BOS and have any questions, comments, suggestions or
  56. complaints, don't hesitate to drop me a line. There is plenty of ongoing
  57. development in BOS, and what seems like growing interest from the net.
  58.  
  59. ---  2nd message, after another cup of coffee and some remeniscence ...
  60.  
  61. Oh, BTW, Motif is a hunk of junk. :-) 1/2. I spent two years building a
  62. substiantial piece of work using it -- a tookit for building DAG-based
  63. UIs. Ever try to subclass a Motif widget? I built an interpreted
  64. environment based on SIOD and my graph representation stuff and built
  65. some fairly intense stuff, but maintaining it and debugging it was a
  66. total headache, and the usual major disconnect between lisp
  67. datatypes/heap and C data still manifested itself. I'm sure GJC can and
  68. does do lovely things with SIOD, but I'm much happier with Tcl. My
  69. solution to the everything-is-a-string problem was to introduct the
  70. notion of FOREIGN slot types into BOS. You can define slot types that
  71. are pointers to hunks of C data by giving BOS pointers to functions that
  72. will copy, free, print and parse such things, and then write methods in
  73. C that deal with such slots and bundle them together in BOS objects;
  74. this is how I implement the BOS HashTable and List objects, for
  75. instance. Very fast and no overhead as long as you don't as a HashTable
  76. to give you all of its contents as a string (which you can ask it to
  77. do), in which case you have to malloc up the string and free it
  78. afterwards; as long as you are playing nice, however, you don't pay the
  79. price. Much easier and safer than extending tcl or playing with lisp,
  80. IMHO.
  81.  
  82. [Note - it took all of two weeks for the initial port of the old
  83. Motif-based DAG toolkit to Tk, which was done with Tk 1.3 (I think,
  84. maybe before that even). The Motif version of the toolkit had taken me
  85. two solid years and still had troubles, mainly due to bizarre
  86. interactions between incestuous Xm widgets and my subclasses of them,
  87. lots of other stuff that I've fogotten about, having been happily
  88. beating on tk/tcl for so long now. Although minor performance tweaks and
  89. bugfixes have been done to the tk version, it hasn't needed any major
  90. overhauls since it was ported. The port and subsequent maintainence
  91. wasn't even done by me, but by a colleague who had done the original,
  92. prehistoric version of the toolkit with an X10 version of the HP widgets.
  93.  
  94. In a subsequent followup, Dan pointed out that Motif has certain
  95. performance advantages over tk, to which I replied that this is a
  96. temporary state of affairs that, due to the nature of tk/tcl
  97. (unencumbered and easily modified), will probably be remedied quickly
  98. enough to warrant hanging around; at least, that's what I'M planning on
  99. doing. Of course, if I get tired of hanging around, I could tweak it
  100. myself, something I wouldn't have DREAMED of doing with Motif except
  101. with the bits I was on extremely intimate terms with, since you never
  102. really knew all the implications of a single change to a single
  103. widget... plus it then becomes non-blessed. --S]
  104. --
  105. Sean Levy, n-dim Group, EDRC, CMU, 5000 Forbes Ave, PGH, PA 15213
  106. Email: snl+@cmu.edu, Phone: +1 412 268 5221, Fax: +1 412 268 5229
  107.