Path: csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.lang.forth Subject: Re: New to the group Date: Wed, 30 Sep 2015 18:11:37 -0400 Organization: Aioe.org NNTP Server Lines: 65 Message-ID: References: <4f5b572c-04ae-433e-bed0-9d7b754bc27b@googlegroups.com> <4340f7c0-4267-494e-988f-bdf6d3c8af0f@googlegroups.com> NNTP-Posting-Host: n4wpt9zq8xR26Ttf9mo2BA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:42284 On Wed, 30 Sep 2015 01:03:32 -0400, Chris Curl wrote: > Fair enough. I actually was looking into it a little tonight, because > I am getting closer to my interpretation loop, and I was curious about > the behavior of ' (TICK). Here is the standard: > > 6.1.0070 ' tick CORE ( "name" -- xt ) > Skip leading space delimiters. Parse name delimited by a space. Find > name and return xt, the execution token for name. An ambiguous condition > exists if name is not found. > > When interpreting, ' xyz EXECUTE is equivalent to xyz. > > Isn't is a pretty common scenario that the user fat-fingers and ' > doesn't find the word? Why do they not say what should be left on > the stack in that case? I understand that it means that I can handle > it however I feel like handling it today, and I can change it tomorrow > if I want, but it also means that I can't write code that uses ' for > other Forths, because I don't know how to determine if it didn't find > the word. Seems kinda silly to me. > ' (tick) for fig-Forth used -FIND and appears to have left a clean stack. -FIND is an immediate which compiles the xt directly. -FIND ( pfa b ft | ff ) Other Forth's might use a sequence similar to this for ' (tick) to work with ANS' FIND: : ' BL WORD FIND DROP ; " 6.1.1550 FIND CORE (c-addr -- c-addr 0 | xt 1 | xt -1 ) Find the definition named in the counted string at c-addr. If the definition is not found, return c-addr and zero. If the definition is found, return its execution token xt. If the definition is immediate, also return one (1), otherwise also return minus-one (-1). For a given string, the values returned by FIND while compiling may differ from those returned while not compiling. " - ANS 94 So, it's likely that c-addr, the original address of the counted string to be found by FIND, will be returned or remain on the stack if a user "fat-fingers" tick, unless an extra IF-ELSE is used to check the state of the flag to also DROP c-addr. Obviously, this depends on the implementation. BTW, when posting to Usenet via Google Groups, your lines should be wrapped at 72 to 75 characters. I fixed your line lengths for you. You might consider wrapping them even shorter so that a few levels of replies indent correctly. Rod Pemberton -- Just how many texting and calendar apps does humanity need? Just how many food articles from neurotic millenials do we need?