Erich Waelde <ew.fo...@nassur.net> writes: > Hi, > > On 03/20/2013 11:29 PM, Enoch wrote: >> Hello AmForth-ers: >> >> Did any of you put "wordlists" into a good use? > > yes. I use this to create a separate wordlist, which > is used to parse a special source code structure. I need > a special wordlist, because I need to *temporarily* "overload" > the meaning of some important words. > > I have also used this to reduce the available wordlist on > the serial interface after startup. > > Also, Lubos Pekny (forth.cz) uses wordlists to separate > things.
So we all agree that wordlists are important. What I asked myself was how to make them easier to use. >> I suspect the answer is no for a simple reason. To use it, say, to >> create a private "scope" ("namespace") of words / variables / constants >> one needs to wrap each dictionary entry with calls to get-current, >> get-order, set-current, set-order, ... too much trouble. >> >> What if we decide that all names that begin with a tilde (~) should >> *automatically* be created into a specific private wordlist. How can we >> accomplish that? > > Well. I do use a number of words myself starting with ~ (tilde). And > I do not agree at all, that creating special prefixes *for everyone* > and do something entirely different with those words, > is the way to go. Even if I need to explicitly enable the feature, > I do not want to have the freedom of choosing token names stumpled upon. > Remember the FORTRAN rule of "undeclared variables starting with [I-N] > are assumed integer"? How awkward. Can I at least choose the prefix > freely? Can it be more than one character? Recognizers would be the > way to go, I think. The thought of imposing naming conventions on other programmers did not even cross my mind :-) > Who stops you from implementing this for your use and put the > resulting code into a message on the list ? (reminder: I will not > look at code elsewhere) And why do you want your solution to be > included into the amforth distribution and *enabled by default*? I will contribute my code and will let Matthias decide on its worthiness and yes, I can live with a rejection :-) Why do I want to have "my" solutions included into the AmForth distribution... I am puzzled by this question -- isn't it the very nature of OSS development, free competition of ideas. By the way, having a "benevolent dictator" who decides about the worthiness of ideas / implementations is well rooted into the OSS culture too. If code is short it will go to the mailing list. If it is long, I disagree, its place is a seperate "pastebin". > What use cases for the suggested feature are you currently looking at? 1. Keeping certain words/variable/constants private, i.e., unknown outside a certain source file. 2. In a large library, say, graphic library, put all public words/... on a seperate wordlist. > Are there other ways to accomplish your goal? Why is this way the > ultimate thing to do? I suggested a kernel hack but I can see high level help in handling wordlists too. How do you utilitize wordlists, using raw get-current, set-current, etc. calls? > Imho Forth is about simplicity. You suggest to add a bit of complexity > (automagic different behaviour). Default behavior would be set-current (of-course). >> Here's my suggestion for your review: >> >> If I am correct the kernel word "header ( addr len wid -- voc-link )" is >> responsible for creating dictionary entries of all kinds. What if this >> "header" would begin with a call to a (e)deferred word, say, "autoscope" >> that would examine the new entry name (via "addr len") and would set the >> "wid" etc. as needed. >> >> In the best Forth tradition let this "autoscope" be initially a NOP and >> allow the programmer to introduce whatever naming scheme he/she desires >> via a subsequent IS. > > But that is a penalty of 1 call to noop for every call of header, and for > everyone. Get serious Erich, that's a one-time compile-time penalty :-) 10000 dictionary-entries × 10µS penalty = 0.1s Regards, Enoch. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel