Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!postnews2.euro.net!news.wanadoo.nl!not-for-mail From: mhx@iae.nl (Marcel Hendrix) Subject: Re: Anonymous code/data/create-does Newsgroups: comp.lang.forth Message-ID: <60650399998434@frunobulax.edu> Date: Thu, 4 Apr 2013 00:38:43 +0200 References: X-Newsreader: iForth 2.0 console (October 21, 2006) Lines: 36 Organization: Wanadoo NNTP-Posting-Date: 03 Apr 2013 22:38:27 GMT NNTP-Posting-Host: s529d937f.adsl.online.nl X-Trace: 1365028707 dr5.euro.net 232 82.157.147.127:64746 X-Complaints-To: abuse@wanadoo.nl Xref: csiph.com comp.lang.forth:21357 Gerry Jackson writes Re: Anonymous code/data/create-does > On 02/04/2013 22:46, Marcel Hendrix wrote: >> Another take on anonymous definitions and anonymous create-does structures. >> Certainly not portable, but interesting to think about. > Seeing your post has triggered me into posting an ANS Forth > implementation of quotations that I developed a bit ago. See the end of > this post for the code and examples of use. It runs on my system, > GForth, Win32Forth, VFX Forth, SwiftForth, BigForth but not iForth. It will run on iForth (at least on my version 4.0.1089 :-), when you add -opt to the definition of ";]". get-current quot-wl set-current : [: ( n -- n+1 ) 1+ [ -opt ] ; \ Start nested quotation : ;] ( n -- n-1 ) 1- [ -opt ] ; \ End of quotation set-current This is actually a very nasty bug you have found! The problem is that iForth's SEARCH-WORDLIST returns ( c-addr u wl -- xt -1 ) and not the ( c-addr u wl -- xt 1 ) that you apparently expect. iForth has turned ;] into an tokenizing word and (because there are no other possibilities) reports the xt as immediate. As you then execute the xt (instead of compiling it) your attempt at decrementing TOS fails and eventually iForth reports end-of-file. The problem does not happen with FIND . At the moment I don't know if this is a simple bug in SEARCH-WORDLIST, or something worse. I faintly remember having looked at it before. Thanks for reporting it. -marcel