Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: What language am I looking for?

From: joel:neely:fedex at: 17-May-2001 8:06

GS Jones wrote:
> Joel, that was a very nice analysis and discussion. > I learned quite a bit. Thanks. > > Just one question right up front: have you mentioned > recently that you like REBOL? ;-) >
Obviously not recently enough! ;-) I'm probably overly sensitive on this point, but some of my attempts at discussing REBOL features, performance, and trade-offs several months back seemed to provoke some REBOL, love it or leave it! responses. Therefore, I try hard to make clear that my comments and questions are offered in the spirit of trying to understand and (occasionally) suggest improvements, not in a spirit of negativity. I certainly do *not* want to offend anyone on the list or at RT, nor fail to show appreciation for everything that's been accomplished to date.
> From: "Joel Neely" > <big snip> > > I'm very interested to see if anyone can suggest any > > others... implementation strategies, > > not properties of the "source code" notation. > > The strategy that I was chewing on yesterday would probably > only make a small, incremental difference at best... It > would seem that there would be at least a small performance > hit with parsing longer "words" (using the REBOL parlance) > as opposed to shorter, and that the performance hit > is additive in loops. I think that I've read that one of > the first tasks that some compilers undertake is to create > its own shortened variable name list... >
As you correctly state, this is a "compile time" issue. The closest analog in REBOL is "load time". I suspect that once a REBOL block has been loaded (converted from external string form into an internal data structure) that the words are actually represented by pointers into a context. If that is correct, then run-time access to the word is a constant-time operation with no dependence on the name length. Of course, the construction of a new context requires some sort of handling of names (or at least pointers to names). REBOL functions/processes that do this include FUNC (and it's siblings FUNCTION and MAKE FUNCTION!), MAKE OBJECT!, and USE. However, even if we drove the time for those operations to zero, it wouldn't speed up most running REBOL scripts by too much. You might be amused to know that early implementations of FORTH had a related technique which often tripped up newbie FORTH programmers. (Remember that FORTH was a truly tiny language, capable of being implemented in a 4k-8k footprint on most microprocessors. Saving memory space was even more of an issue than speeding word lookup.) A common technique for storing word names in a dictionary was to use the first three characters of the word and a one-byte length. This meant that it was all to easy to accidentally create name collisions, such as first -> "fir" 3 firms -> "fir" 3 You can image the possibilities for bug-breeding! -jn- -- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com