POSTPONE executes inside of the [ ... ] brackets, and it is:
"no interpretation semantics for this word are defined."
This means that the code is not ANS-Forth.
PPP1 would execute if it were immediate, and this would be
illegal if it were a "no interpretation semantics defined" word
such as IF COMPILE, R> etc..
PPP1 is not immediate in this example though, so it just gets compiled,
but doesn't execute. POSTPONE compiles it with COMPILE, internally.
Gerry Jackson is using ye olde straw-man argument to attack me.
I never said that POSTPONE of a non-immediate word caused that
word to be executed at compile-time. Everybody knows that this
is not what POSTPONE does. Gerry Jackson is fabricating again.
> I'll add POSTPONE to the list of things in the ANS standard you don't
> understand or didn't know existed like ACCEPT, CATCH & THROW, GET-ORDER
> & SET-ORDER, the fact that a cross compiler can be written in ANS Forth,
> that disambiguifiers are not ANS Forth compliant ... oh yes and pointers.
This is just a typical ANS-Forth cult troll-attack.
> > There is really no difference between executing a disambiguified word
> > or the pre-disambiguified word. It does the same thing either way.
> > The disambiguification only affects what FIND does when given the name
> > of the word. The disambiguifier allows FIND to find an xt, it allows
> > FIND to return the same xt whether STATE is true or false when FIND
> > executes, and it allows FIND to indicate that the word is immediate.
> > That is all that the disambiguifier does.
> > The disambiguifier doesn't give the word any new properties that
> > it didn't previously have, or change how it behaves in any way
> > (except you get a warning message when you execute it when STATE
> > is zero; this was always illegal, but you didn't get warned previously).
>
> Typical Aguilar deflection away from the subject being discussed.
> Disambiguifiers and FIND are irrelevant here.
> ...
> > Gerry Jackson has joined the liars Anton Ertl and Alex McDonald
> > in telling this preposterous lie, founded upon magical thinking.
>
> Is 'magical thinking' another term for a reasoned argument? No wonder
> you're confused.
By "magical thinking" I'm referring to Anton Ertl's claim that
a disambiguifier magically changes the behavior of the word being
disambiguified --- i.e., that it allows it to execute when STATE is zero
despite it being: "no interpretation semantics defined."
This works in a few cases: a compiling word used inside of [ ... ] brackets.
This doesn't work most of the time. The disambiguifier doesn't magically
make this legal ANS-Forth in the few cases in which it does work.
The disambiguifier's only purpose is that it allows FIND to work
properly on the word. Previously FIND was broken.
The disambiguifier doesn't change the definition of the word itself.
> > Note that this isn't the first time that Gerry Jackson has tried to
> > "educate" me on a subject that he knows nothing about, after I had
> > written ANS-Forth code that worked.
> > He tried to educate me on how many comparisons m SORT-EIGHT requires
> > (he said 19) after I had already posted code that did the sort in
> > 12 to 17 comparisons (Alex McDonald said a minimum of 16).
> >
> > Gerry Jackson also tried to educate me on how to write SET-CONTEXT
> > in ANS-Forth that does what setting CONTEXT did in Forth-83.
> > Of course, he failed to write any code that works, and this was
> > after I had posted code that did work. He said that I didn't know
> > how SET-ORDER works, despite the fact that my code relies on
> > SET-ORDER and despite the fact that he didn't know what SET-ORDER does
> > (he didn't understand that SET-ORDER will clobber FORTH-WORDLIST
> > unless this "anchor" wid is explicitly checked for).
>
> And you made a claim that something couldn't be done, I challenged you
> to say what it was and you didn't reply because you were wrong.
This is the thread in which you were trying to "educate" me on
the subject of SET-ORDER (you don't know how it works though):
https://groups.google.com/forum/#!topic/comp.lang.forth/wNYAbr6ltTU
This is what I said:
On Wednesday, June 26, 2019 at 6:14:31 PM UTC-7,
hughag...@gmail.com wrote:
> On Wednesday, June 26, 2019 at 1:10:07 PM UTC-7, Gerry Jackson wrote:
> > On 26/06/2019 14:39,
hughag...@gmail.com wrote:
> > > Now I have induced Gerry Jackson to make a fool of himself again!
> > > I clearly stated that I wanted the same functionality as
> > > we had in Forth-83 because I was porting MFX from Forth-83
> > > to ANS-Forth. In Forth-83, when CONTEXT was set, this did NOT
> > > remove the FORTH vocabulary from the search.
> >
> > Bollocks! You stated:
> > <aguilar-quote>In Forth-83 it was possible to set the CONTEXT vocabulary.
> > I needed this for my cross-compiler because I was porting from
> > MFX which is a Forth-83 cross-compiler.
> > This functionality is not possible with ONLY ALSO however.</aguilar-quote>
> >
> > That doesn't say or even imply that the Forth wordlist had to be
> > retained in the search order.
>
> You aren't familiar with Forth-83?
> In Forth-83, setting CONTEXT retained the FORTH vocabulary
> in the search order (the FORTH vocabulary gets searched after
> whatever vocabulary is in CONTEXT at the time).
>
> > Anyway I think you're trying to deflect attention from the fact that you
> > didn't know SET-ORDER existed in the ANS Forth standard (deflecting
> > attention is another tactic you frequently use).
>
> My code uses GET-ORDER and SET-ORDER internally,
> so I obviously know about those words.
>
> > > On Wednesday, June 26, 2019 at 2:44:41 AM UTC-7, Gerry Jackson wrote:
> > >> Assuming you want SET-CONTEXT to set the search order to wid only (if
> > >> not please explain what it's meant to do), why can't
> > >> SET-ORDER ( widn ... wid1 n -- ) be used ...
> > >
> > > Why would you assume that, considering that this is exactly
> > > what I said that I did NOT want?
> >
> > No you didn't, see above. If you'd said that I wouldn't have made that
> > assumption.
>
> Once again --- I said that it should have the same functionality
> as setting CONTEXT did in Forth-83 --- this implies that your
> assumption was NOT what I wanted.
>
> > > Raw use of SET-ORDER fails badly because, if FORTH-WORDLIST
> > > happens to be the top value in the search list, it gets clobbered.
> > > This really throws a monkey-wrench into the system!
> >
> > Depends what you mean by 'raw use', if you mean 1 SET-ORDER then it's
> > bleedin' obvious it clobbers whatever is at the head of the search
> > order. If not then that's more proof that you didn't know about
> > SET-ORDER as it doesn't necessarily clobber forth-wordlist e.g. basic
> > use of SET-ORDER is
> >
> > : educating-hugh ( wid -- ) >r get-order r> swap 1+ set-order ;
> >
> > preserves whatever was in the search order and adds wid at the head of it.
> >
> > And yes I expect you'll use your new tactic and say that was another trap.
>
> Setting CONTEXT in Forth-83 does not preserve the search order.
> It clobbers whatever was in CONTEXT previously.
> This is what my SET-CONTEXT word does (unless it was FORTH-WORDLIST on top).
> This is NOT what your EDUCATING-HUGH word does --- you are still failing.
>
> > You seem to think that the search-order word set cannot do something
> > with wordlists that can be trivially achieved in Forth 83.
>
> I was able write SET-CONTEXT using GET-ORDER and SET-ORDER to upgrade
> ANS-Forth to do what setting CONTEXT did in Forth-83.
>
> My point is that ANS-Forth is badly designed because I needed
> to write SET-CONTEXT (pretty complicated!) in order to upgrade
> ANS-Forth to do what was trivial in Forth-83.
> ANS-Forth was supposed to support "common practice," yet it failed
> to support common practice in Forth-83 (setting the CONTEXT while
> retaining the FORTH vocabulary) out of the box.
> Once again, I am writing code to fix Elizabeth Rather's blunders.
This was my code that works (none of Gerry Jackson's posted code works).
I have written SET-CONTEXT that upgrades ANS-Forth to the level
of Forth-83 in that SET-CONTEXT sets the context, similar to how
storing a vocno into CONTEXT did in Forth-83.
On Monday, June 24, 2019 at 6:11:43 AM UTC-7,
hughag...@gmail.com wrote:
> On Monday, June 24, 2019 at 5:03:16 AM UTC-7, Doug Hoffman wrote:
> > I find the current wordlists implementation to be very
> > straightforward, usable, and understandable.
>
> That is some grotesque brown-nosing!
> ANS-Forth wordlists are pretty much unusable as provided.
> Nobody would make a statement such as Doug Hoffman made
> above who had actually used wordlists for anything non-trivial.
> There are severe problems with using the word-list list as
> a stack. You often get duplicates in the stack. This creates
> confusion when you later try to pop a wordlist off the stack.
> You also have to make sure that your anchor wordlist (usually
> the FORTH wordlist) doesn't get popped.
>
> I had to write a significant amount of code to make wordlists
> usable for my cross-compiler:
> -------------------------------------------------------------------------
> \ ******
> \ ****** Some word-list stuff.
> \ ******
>
> : set-forth ( -- ) \ sets default configuration
> only forth definitions ;
>
> : <get-context> ( -- wid ) \ like CONTEXT @ in Forth-83 (ANS-Forth already provides GET-CURRENT)
> get-order dup 1 < abort" *** GET-CONTEXT given empty search-order ***"
> over >r \ r: -- top-wid
> 0 do drop loop \ --
> r> ;
>
> : <push-context> { wid -- }
> get-order
> wid swap 1+ \ put WID on top of whatever is there
> set-order ;
>
> \ <PUSH-CONTEXT> always pushes WID, even if WID is already the 1st. It has to be consistent in always pushing, so <POP-CONTEXT> can pop what was pushed.
>
> : <pop-context> ( -- wid ) \ undo PUSH-CONTEXT and return the wid
> get-order dup 1 < abort" *** POP-CONTEXT given empty search-order ***"
> swap >r 1-
> set-order
> r> ;
>
> : <drop-context> ( -- )
> <pop-context> drop ;
>
> \ <GET-CONTEXT> <PUSH-CONTEXT> <POP-CONTEXT> and <DROP-CONTEXT> don't take into consideration LOCALVARS# being in the way.
>
> \ VFX pushes a wid called LOCALVARS onto the search order in colon words that have locals, then pops it off again at the semicolon.
> \ It is in the way. If you set the 1st value to a replacement wid, you will replace LOCALVARS rather than the wid you thought you were replacing (which is now 2nd).
> \ This is a gross violation of the ANS-Forth standard (13.3.3-1):
> \ "...if the Search-Order word set is present, local identifiers shall always be searched before any of the word lists in any definable search order,
> \ and none of the Search-Order words shall change the locals’ privileged position in the search order."
>
> \ Note: Stephan Pelc fixed the bug mentioned above in version 4.71.3523 of Oct.8,2014.
>
> \ The following definition of SET-CONTEXT works around the bug in VFX, and will also work in Forths that don't have the bug.
>
> false value localvars# \ this is the wid that is 1st in the search-order inside of colon words that have local variables
> marker temporary
> false value expected# \ this is the wid that we are expecting to be 1st
>
> : fill-localvars# ( -- ) \ this fills <LOCALVARS> at compile-time for use by <SET-CONTEXT> --- it doesn't do anything at run-time
> true abort" *** FILL-LOCALVARS# is not to be run, it fills LOCALVARS# at compile-time ***"
> [ <get-context> to expected# ]
> 1 2 3 locals| x y z |
> [
> <get-context> expected# <> [if]
> <pop-context> to localvars#
> <get-context> expected# <> [if] .( *** FILL-LOCALVARS# can't find EXPECTED# ***) abort [then]
> localvars# <push-context> [then]
> ] ;
>
> \ FILL-LOCALVARS# doesn't have to run --- it fills LOCALVARS# at compile-time.
> temporary \ discard this code that fills LOCALVARS# at compile-time --- it is never needed again
>
> : push-underneath { wid -- } \ push WID underneath whatever is 1st so WID becomes 2nd, leaving 1st as 1st
> <pop-context> \ hold 1st
> <get-context> wid <> if
> wid <push-context> then \ don't push WID on top of itself (if WID was 2nd originally)
> <push-context> ; \ push 1st back on top
>
> : replace-1st ( wid -- )
> push-underneath <drop-context> ; \ use PUSH-UNDERNEATH so WID is not duplicated if it already 2nd
>
> : <set-context> { wid anchor -- }
> <get-context> anchor = if \ if ANCHOR is 1st
> wid anchor = if exit then \ WID is already 1st, so we are done
> wid <push-context> \ push WID on top of ANCHOR, rather than replace ANCHOR
> exit then
> <get-context> localvars# = if \ if LOCALVARS# is 1st
> <pop-context> \ -- localvars#
> <get-context> anchor = if \ if ANCHOR is 2nd
> wid <push-context> \ push WID on top of ANCHOR, rather than replace ANCHOR
> else
> wid replace-1st then \ else, replace 2nd with WID
> <push-context> \ restore LOCALVARS# as 1st
> exit then
> wid replace-1st ; \ 1st was neither ANCHOR nor LOCALSVAR#, so we just replace 1st with WID (now GET-CONTEXT will give us WID)
>
> : set-context ( wid -- )
> forth-wordlist <set-context> ;
>
> \ FORTH-WORDLIST SET-CONTEXT would do the same thing that FORTH does.
>
> \ The following PUSH-CONTEXT POP-CONTEXT and DROP-CONTEXT take into account LOCALVARS#.
> \ Use xxx PUSH-CONTEXT rather than ALSO xxx SET-CONTEXT because everything goes haywire if the ANCHOR is the 1st wid.
> \ All in all, ALSO is a screw-ball idea because it involves making a duplicate on the search-order, which makes no sense.
> \ Forth is supposed to be context-free, but ALSO only makes sense when it is followed by SET-CONTEXT (but not when the anchor is 1st).
> \ In this 1993 comp.lang.forth thread:
https://groups.google.com/forum/#!topic/comp.lang.forth/olO-VHXJa1Q
> \ Ray Duncan (who sold UR/Forth back then), described ONLY/ALSO as "severely brain-damaged."
> \ Apparently he had zero influence over ANS-Forth design though, because he gave up on Forth after ANS-Forth came out in 1994.
>
> : get-context ( -- wid )
> <get-context> \ -- 1st
> dup localvars# = if drop \ --
> <pop-context> <get-context> \ -- 1st 2nd
> swap <push-context> then ; \ -- 2nd
>
> : definitions ( -- ) \ the VFX version of DEFINITIONS has a bug in that it doesn't take LOCALVARS into consideration
> get-context set-current ;
>
> : push-context { wid -- }
> <get-context> localvars# = if
> <pop-context> wid <push-context> \ -- 1st
> <push-context> \ --
> else
> wid <push-context> then ;
>
> : pop-context ( -- wid ) \ undo PUSH-CONTEXT and return the wid
> <pop-context> \ -- 1st
> dup localvars# = if
> <pop-context> \ -- 1st 2nd
> swap <push-context> then ; \ -- 2nd
>
> : drop-context ( -- )
> pop-context drop ;
>
> \ Problems may arise when using PUSH-CONTEXT and POP-CONTEXT if two wids are supposed to have words of the same name.
> \ The user does a PUSH-CONTEXT of one of the wids, but the other wid is already in the search-order.
> \ The user then looks up a word name. Unfortunately, the wid on top that is supposed to have that name doesn't have it, and so the name is found in the other wid.
> \ Because of this problem, it is best to check every xt with IN-WORDLIST? to make sure that it was defined in the expected word-list.
> \ Unfortunately, IN-WORDLIST? doesn't always work because it depends upon >NAME that is not ANS-Forth (some ANS-Forth systems, such as VFX, have it though).
>
> : this-before-that? { this that | this-first? that-first? -- ? }
> false to this-first?
> false to that-first?
> get-order 0 ?dup do
> dup this = if that-first? 0= if true to this-first? then then \ don't set THIS-FIRST? if we have already found THAT
> that = if this-first? 0= if true to that-first? then then \ don't set THAT-FIRST? if we have already found THIS
> loop
> this-first? ;
>
> \ THIS-BEFORE-THAT? may be more useful than GET-CONTEXT because it searches the entire search-order.
> -------------------------------------------------------------------------
Also:
On Monday, June 24, 2019 at 6:17:07 AM UTC-7,
hughag...@gmail.com wrote:
> On Monday, June 24, 2019 at 6:11:43 AM UTC-7,
hughag...@gmail.com wrote:
> > \ Problems may arise when using PUSH-CONTEXT and POP-CONTEXT if two wids are supposed to have words of the same name.
> > \ The user does a PUSH-CONTEXT of one of the wids, but the other wid is already in the search-order.
> > \ The user then looks up a word name. Unfortunately, the wid on top that is supposed to have that name doesn't have it, and so the name is found in the other wid.
> > \ Because of this problem, it is best to check every xt with IN-WORDLIST? to make sure that it was defined in the expected word-list.
> > \ Unfortunately, IN-WORDLIST? doesn't always work because it depends upon >NAME that is not ANS-Forth (some ANS-Forth systems, such as VFX, have it though).
> >
> > : this-before-that? { this that | this-first? that-first? -- ? }
> > false to this-first?
> > false to that-first?
> > get-order 0 ?dup do
> > dup this = if that-first? 0= if true to this-first? then then \ don't set THIS-FIRST? if we have already found THAT
> > that = if this-first? 0= if true to that-first? then then \ don't set THAT-FIRST? if we have already found THIS
> > loop
> > this-first? ;
> >
> > \ THIS-BEFORE-THAT? may be more useful than GET-CONTEXT because it searches the entire search-order.
>
> I forgot to show my definition for IN-WORDLIST? that
> is mentioned above. Here it is:
> ----------------------------------------------------------------------
> VFX? [if] \ We have >NAME so error-checking will be done. This code may work in other ANS-Forth systems as well.
>
> : in-wordlist? ( xt wid -- 0|1|-1 ) \ we return 0 for not-found, 1 for immediate and -1 for non-immediate
> over >name count rot search-wordlist \ -- xt 0 | xt found-xt 1 | xt found-xt -1
> >r
> r@ 0= if drop r> exit then \ it wasn't found
> = if r> exit then \ it was found and it is the same
> r> drop 0 ; \ it was found but it wasn't the same (it had the same name, but was a different word)
>
> [else] \ We can't be sure that >NAME will be available except in VFX, so error-checking won't be done.
>
> : in-wordlist? ( xt wid -- 0|1|-1 )
> true abort" *** IN-WORDLIST? is not available except in VFX" ;
> immediate
>
> [then]
> ----------------------------------------------------------------------