home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / archives / 3142 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  6.3 KB

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