home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / forth / 3054 < prev    next >
Encoding:
Text File  |  1992-08-29  |  10.8 KB  |  239 lines

  1. Newsgroups: comp.lang.forth
  2. Path: sparky!uunet!starnine!mikeh
  3. From: mikeh@starnine.com (Mike Haas)
  4. Subject: Re: "Free" Forth is expensive
  5. Message-ID: <BtqHx6.8I3@starnine.com>
  6. Sender: mikeh@starnine.com (Mike Haas)
  7. Date: Sat, 29 Aug 1992 07:24:41 GMT
  8. References: <5657@transfer.stratus.com> <BtIoro.Gnt@starnine.com> <5881@transfer.stratus.com>
  9. Organization: StarNine Technologies, Inc.
  10. Lines: 227
  11.  
  12. In article <5881@transfer.stratus.com> nick@sw.stratus.com (Nicolas Tamburri) writes:
  13. >mikeh@starnine.com (Mike Haas) replies to me who replied to him:
  14. >> JForth's structure mechanism is sufficient to represent every standard
  15. >> Amiga ".h" file (and there are a TON of 'em) in JForth ".j" form.
  16. >> Even unions and enums are supported.  signed & unsigned members (which 
  17. >> infers auto-sign-extension).  and the only structure operators needed are
  18. >> "s@" and "s!".
  19. >> 
  20. >> It's not as good as C, but heaven for Forth.  Since you've used JForth,
  21. >> you no doubt are aware that it provides a utility to do 90% of the
  22. >> work in converting a ".h" file to it's equivalent ".j" for you.
  23. >> 
  24. >> What more does Forth need?  (That, of course is a hypothetical
  25. >> question, since most Forths do not contain any structure mechanism).
  26. >
  27. >Bearing in mind that I used version 1 JForth:  I remember that the
  28. >struct mechanism did not really scope well, meaning that I could not
  29. >have two structures with the same element names.
  30.  
  31. That is still a limitation.  But this is just a naming issue.  We adopted
  32. the technique used in the Amiga assembler includes (assembler 'structures'
  33. have the same limitation)... that is to use the same
  34. standard prefix for different structures. For example, the
  35. 'width' element for a window and a screen...
  36.  
  37.    MyWindow s@ wd_Width
  38.    MyScreen s@ sc_Width
  39.  
  40. As the assembler includes defined these for us already, we were assured
  41. of standard, unique names, even the same ones that are documented
  42. in Amiga tecnical literature.
  43.  
  44. >The convention was that
  45. >one preceded the name of any element with a couple of characters related to
  46. >the name of the structure they belonged to.  
  47.  
  48. You have a good memory... that's what I describe above.  As I said,
  49. these are not custom structure names, but standard Amiga-documented ones.
  50. So it was more than just a forth-convention, it was a platform-OEM
  51. convention.
  52.  
  53. >I also don't recall s@ and s! .
  54.  
  55. They came along in 2.0.  They do the same as ..@ and ..!, except that
  56. they look at the structure element to see if is of type APTR, and
  57. if so, automatically convert the returned address to JForth-relative
  58. form (does the >REL for you, or >ABS on stores).
  59.  
  60. ..@, ..!, s@ and s! all do auto-sizing (byte, word, or long) and (if
  61. the struct element is signed) sign-extension.
  62. >Did they exist in v1?  I assume that they know the size of the element, and
  63. >store or fetch based on that, which is very good.
  64. >
  65. >Data structures have always been a limitation in Forth.  I don't see
  66. >how it could really be fixed (in a standard way,)  without hacking up the
  67. >interpreter to first look for a word, then a number and then try to parse
  68. >a structure element along the line of struct.element.subelement.etc . I
  69. >don't think too many people in this group would really go for that.
  70.  
  71. JForth's structure mechanism could be implemented in any
  72. Forth with standard CREATE DOES> words, I believe.  The great benefit
  73. is that the high-level interface is completely independant of the
  74. platform specific hardware quirks, such as byte ordering, cell-width,
  75. etc.
  76.  
  77. >
  78. >> >I would be very hesitant to use many of the
  79. >> >things which make JForth good because I know they are not portable to
  80. >> >the PC, or Mac or Atari ST or just about anything else.  I'm not talking
  81. >> >about screen library routines.  I know I'm going to have to write
  82. >> >platform specific versions of those.  I'm talking about structure
  83. >> >access routines, ODE, Amiga specific multi-tasking tricks.
  84. >> >Things that are an inherent part of JForth and no other Forth.
  85. >> 
  86. >> I don't see how.  First of all, you don't HAVE to use the fancy
  87. >> aspects of any Forth, if your goal is to create base-line Forth code
  88. >> that can move anywhere.  There IS FORTH under there, after all!
  89. >
  90. >Right.  my point exactly.  You've given me all this power, and I have to
  91. >limit my use of it because it's not standard to any other Forth.  So what
  92. >does all this functionality do for me.  For my money, I'd rather have the
  93. >ultimate programming environment, than the ultimate number of libraries.
  94. >I kind of like the way MachII approach to libraries on the Mac:  provide a
  95. >generalized CALL word into the toolbox and let the user build only library
  96. >interfaces needed for the application.
  97.  
  98. JForth provides the same CALL-type word to access the Amiga's libraries.
  99. In fact, the Amiga is much better, because on the Mac, many of the
  100. routines documented in 'Inside Mac' are marked "Not in Rom".  This means
  101. you have to LINK the object into your application...so you know where
  102. that leaves any Forth.  For example, you cannot call words like
  103. TopMem(), MoveHHi(), PrOpen(), RamSDOpen(), Open & CloseDriver(),
  104. StartSound()... on and on...many more...from any Forth.
  105.  
  106. The Amiga interface has about 4 of these kind of functions, so it was
  107. very simple to provide the Forth-source equivalent for the C-published
  108. routines.  All the rest of the OS calls are in the form of shared
  109. libraries, which JForth can access 100% by name, with a CALL compiler
  110. which even pulls function args from the stack in the same order as
  111. described in all standard tech literature, and stuffs the correct
  112. CPU registers...automatically!
  113.  
  114. >
  115. >> Second, how hard can it be to implement some of that interface
  116. >> in another platform's Forth?  Or create your own "layer" that you
  117. >> implement in JForth and ??Forth, using the features specific to
  118. >> each.
  119. >
  120. >Assuming a base-line implementation, yes, but see my last paragraph.
  121.  
  122. The more work you put into the interface, the more platforms and
  123. applications it will serve, the easier it will be to program
  124. with.
  125.  
  126. Dr. Martin Kees, a real JForth power-user and author of many
  127. cool shareware programs illustrated this by developing a C-string
  128. package for JForth.  it allows you to put tokens like '\n' %s
  129. etc INSIDE Forth strings.  It's implementable in any Forth, and
  130. because it's NOT minimal, the syntax will work in any Forth.
  131.  
  132. (BTW, Martins largest effort that I know of is called XL.  It's a
  133. graphic bases animator package...full GUI provided, with a large
  134. set of AREXX commands via which the program can control and be
  135. contriolled by other programs, as well as providing a "scripting"
  136. capability to the user.  The program uses a popular animation-display
  137. technique called a Light-Table to illustrate the "flow" of
  138. the frames of the animation you are creating.  The program is a
  139. 97K standalone-executable, generated with JForth's CLONE facility).
  140.  
  141. >
  142. >> Phil Burk's ODE runs on top of JForth and is offerred with the
  143. >> product.
  144. >
  145. >Unless ODE has been ported to other platforms as well, I can't use it
  146. >if I want portability.
  147.  
  148. It has.  It's runs on the Mac under Mach2 and Phil's own Forth package.
  149. No reason it shouldn't be implenmentable on the PC, either, I think.
  150.  
  151. >Does the JForth licence say that I can take the
  152. >ODE source,  (which comes with JForth still, correct?) and port it to
  153. >another platform and then distribute the product?
  154.  
  155. ODE is Phil's creation.  He lets Delta Research include it
  156. in JForth (not too hard to arrange, since he's in Delta Research,
  157. too).  But you'de have to work out liscencing matters with him.
  158. He'd probably like the idea, but I can't speak for him.
  159.  
  160. >(This ties neatly
  161. >into my other favorite topic of having a consistent interface to the
  162. >dictionary headers,  but I won't get into that now.  :-)
  163. >
  164. >
  165. >> [Description of HMSL deleted.]
  166. >>
  167. >>  ... but the point is that the EZMenus & EZGraphics
  168. >> interfaces of JForth also exists on the Mac (although his H4TH is
  169. >> heavily geared toward HMSL and isn't exactly a general purpose
  170. >> Forth) so it can be done.
  171. >
  172. >Sorry, this doesn't count.  It would if H4TH was general purpose
  173. >and readily available for program development.  Otherwise it does me
  174. >no good.
  175.  
  176. The core to H4TH is ODE (which IS a general purpose object-oriented
  177. language VERY similar to YERK).  HMSL is an application built on top
  178. of ODE, which has been built on top of 5 Forths that I know of.
  179.  
  180. >
  181. >> Actually, I don't see where C or any language has much advantage
  182. >> over Forth if we're talking porting graphics, sound, etc.  There
  183. >> are no standard C libraries to cover such concepts, as there are
  184. >> simple character-based I/O (stdio.h for C, KEY & EMIT for Forth).
  185. >
  186. >Agreed, but I've never argued this point.  I already conceded that
  187. >I would have to port graphics and sound routines.  The advantage of
  188. >"C" is that it provides a consistent data structure interface across
  189. >all platforms, and a consistent language for extending the language,
  190. >(even though Forth is more extendable, "C" does provide for limited
  191. >extendability through #defines and typedefs.)
  192.  
  193. Yeah, C is a great language.  Forth has tools that can be used to
  194. construct structure-mechanisms, but it does suffer in that it has
  195. no standard one (similar to the CASE statement and other stuff).
  196.  
  197. I think that Forth's extensibility is actually a disadvantage in
  198. this area.  Everyone can come up with their own.  C programmers
  199. are stuck (???) with the structure mechanism of C...you can't
  200. duplicate that functionality with #define's and typedefs.  Same
  201. as CASE... same as...etc etc.  The benefit for C is that complex
  202. mechanisms are standardized.
  203.  
  204. >
  205. >> Yes, the WORDS list of any Forth appears intimidating.  But
  206. >> a fair portion of those words simply support another function.
  207. >> In other words, some of them will never need to be known.
  208. >
  209. >I'm not sure you're right about this.  But if you are, I think
  210. >commercial packages should start using vocabularies a little more.
  211.  
  212. Except that vocabularies in themselves are not standard.  Even the
  213. mechanisms which were at one time standard (as in FIG), have lost
  214. this quality.  It's a real shame.
  215.  
  216. >
  217. >> If the Forth community could AGREE on standards, they could begin to be
  218. >> implemented cross-platforms.  We have just gotten to the point
  219. >> where the majority of the community FINALLY recognizes the iomportance of
  220. >> file and memory interfaces, much less graphics standards.  Honestly,
  221. >> the proponents of this language have always been more concerned
  222. >> with vehement discussion about whether state-smart words should
  223. >> be disallowed and whether WORD returns HERE or not.  We have
  224. >> fought over SCREENS and FILES while the rest of the world was
  225. >> discussing device-independant graphics!
  226. >
  227. >No argument here.  I can understand the reason esoteric discussions
  228. >on keeping the language "pure",  but I think we really should start
  229. >bringing this language out of the 70's and into a world where computers
  230. >have operating systems.  When I look at some of the hacks put into C++,
  231. >I don't think we have anything to be ashamed of regarding purity.
  232. >
  233. >                            /nt
  234.  
  235. Well said.  And very true.
  236.  
  237.  
  238.  
  239.