Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #36621 > unrolled thread
| Started by | empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> |
|---|---|
| First post | 2015-02-17 00:46 +0000 |
| Last post | 2015-02-18 10:20 -0800 |
| Articles | 20 on this page of 24 — 10 participants |
Back to article view | Back to comp.lang.forth
Search order - why usually two times "Forth"? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-02-17 00:46 +0000
Re: Search order - why usually two times "Forth"? "Alex McDonald" <blog@rivadpm.com> - 2015-02-17 09:33 +0000
Re: Search order - why usually two times "Forth"? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-02-17 10:08 +0000
Re: Search order - why usually two times "Forth"? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-02-17 11:07 +0000
Re: Search order - why usually two times "Forth"? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-02-17 12:54 +0000
Re: Search order - why usually two times "Forth"? empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-02-17 18:38 +0000
Re: Search order - why usually two times "Forth"? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-02-18 11:31 +0000
Re: Search order - why usually two times "Forth"? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-02-18 13:16 +0000
Re: Search order - why usually two times "Forth"? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-02-18 14:00 +0000
Re: Search order - why usually two times "Forth"? "Alex McDonald" <blog@rivadpm.com> - 2015-02-18 16:44 +0000
Re: Search order - why usually two times "Forth"? november.nihal@gmail.com - 2015-02-17 07:13 -0800
Re: Search order - why usually two times "Forth"? "Elizabeth D. Rather" <erather@forth.com> - 2015-02-17 08:21 -1000
Re: Search order - why usually two times "Forth"? "Alex McDonald" <blog@rivadpm.com> - 2015-02-17 18:43 +0000
Re: Search order - why usually two times "Forth"? "Elizabeth D. Rather" <erather@forth.com> - 2015-02-17 11:59 -1000
Re: Search order - why usually two times "Forth"? hughaguilar96@gmail.com - 2015-02-17 18:30 -0800
Re: Search order - why usually two times "Forth"? JennyB <jennybrien@googlemail.com> - 2015-02-18 04:01 -0800
Re: Search order - why usually two times "Forth"? hughaguilar96@gmail.com - 2015-02-18 18:13 -0800
Re: Search order - why usually two times "Forth"? "HAA" <someone@microsoft.com> - 2015-02-28 11:35 +1100
Re: Search order - why usually two times "Forth"? "Alex McDonald" <blog@rivadpm.com> - 2015-02-18 12:34 +0000
Re: Search order - why usually two times "Forth"? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-02-18 12:28 +0000
Re: Search order - why usually two times "Forth"? jacko <jackokring@gmail.com> - 2015-02-18 08:49 -0800
Re: Search order - why usually two times "Forth"? jacko <jackokring@gmail.com> - 2015-02-18 09:04 -0800
Re: Search order - why usually two times "Forth"? jacko <jackokring@gmail.com> - 2015-02-18 10:17 -0800
Re: Search order - why usually two times "Forth"? jacko <jackokring@gmail.com> - 2015-02-18 10:20 -0800
Page 1 of 2 [1] 2 Next page →
| From | empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> |
|---|---|
| Date | 2015-02-17 00:46 +0000 |
| Subject | Search order - why usually two times "Forth"? |
| Message-ID | <slrnme53rj.1qm.empty.buffersYOU-DONT-WANT-THIS@Ferrycy.localdomain> |
I noticed usually ANS-compliant Forth implementations have doubled the first position in "Search order", like this (Gforth as example): order Forth Forth Root Forth ok 1. Why is that? In case of need the first position can always be duplicated with ALSO, therefore why it's doubled by default (well, not always, tbh)? 2. And does that mean, that in case the word isn't found, text interpreter will search "Forth" vocabulary for the second time, although this one just has been searched with no success? -- - "I'll pulverize Trurl!" - said the machine - "But first, he'll tell me how much two and two makes." [..] - "Fo... that is, seven..."
[toc] | [next] | [standalone]
| From | "Alex McDonald" <blog@rivadpm.com> |
|---|---|
| Date | 2015-02-17 09:33 +0000 |
| Message-ID | <mbv1rd$r44$1@dont-email.me> |
| In reply to | #36621 |
on 17/02/2015 00:46:48, empty-buffers wrote: > I noticed usually ANS-compliant Forth implementations have doubled the > first position in "Search order", like this (Gforth as example): > > order Forth Forth Root Forth ok > > 1. Why is that? In case of need the first position can always be > duplicated with ALSO, therefore why it's doubled by default (well, not > always, tbh)? We may want to force a specific vocabulary to be where words are defined. The quickest way of doing this, without disrupting the previously set word order, is ALSO FORTH DEFINITIONS My Forth does that at warm start after leaving the kernel cold startup. It could do ONLY FORTH DEFINITIONS but warm startup is also entered after an error that forces us back to the interpreter. Losing all the search order makes debugging very hard, so it doesn't do it by default. > > 2. And does that mean, that in case the word isn't found, text > interpreter will search "Forth" vocabulary for the second time, > although this one just has been searched with no success? Win32Forth and my Forth W32F search once in the first occurence and skip the second where the same dictionary is next in the order. It's not really required, although it's simple to implement in both systems. The overhead of searching is pretty small, and normally only happens during compile or interpretation. Run time code is normally unaffected by a double search since it rarely does them.
[toc] | [prev] | [next] | [standalone]
| From | empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> |
|---|---|
| Date | 2015-02-17 10:08 +0000 |
| Message-ID | <slrnme64oj.5lh.empty.buffersYOU-DONT-WANT-THIS@Ferrycy.localdomain> |
| In reply to | #36631 |
In comp.lang.forth, Alex McDonald wrote: > We may want to force a specific vocabulary to be where words are defined. > The quickest way of doing this, without disrupting the previously set > word order, is > > ALSO FORTH DEFINITIONS Not sure do I follow. Do you mean, that initial state could be: order Forth Forth Root Forth ok And then someone may want to include other vocabulary into search order: assembler ok order assembler Forth Root Forth ok definitions ok order assembler Forth Root assembler ok ...and then he may want to get back to "Forth" in the first place for definitions: also forth definitions ok order Forth assembler Forth Root Forth ok If this is, what you meant, then still we keep always "superfluous" entry "Forth". And this is only because someone may forget to type "also assembler" instead of "assembler" alone? Right? -- - "I'll pulverize Trurl!" - said the machine - "But first, he'll tell me how much two and two makes." [..] - "Fo... that is, seven..."
[toc] | [prev] | [next] | [standalone]
| From | albert@spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2015-02-17 11:07 +0000 |
| Message-ID | <54e320f5$0$14947$e4fe514c@dreader35.news.xs4all.nl> |
| In reply to | #36631 |
In article <mbv1rd$r44$1@dont-email.me>, Alex McDonald <blog@rivadpm.com> wrote: >on 17/02/2015 00:46:48, empty-buffers wrote: >> I noticed usually ANS-compliant Forth implementations have doubled the >> first position in "Search order", like this (Gforth as example): >> >> order Forth Forth Root Forth ok >> >> 1. Why is that? In case of need the first position can always be >> duplicated with ALSO, therefore why it's doubled by default (well, not >> always, tbh)? > >We may want to force a specific vocabulary to be where words are defined. >The quickest way of doing this, without disrupting the previously set >word order, is > >ALSO FORTH DEFINITIONS > >My Forth does that at warm start after leaving the kernel cold startup. >It could do > >ONLY FORTH DEFINITIONS > >but warm startup is also entered after an error that forces us back to >the interpreter. Losing all the search order makes debugging very hard, >so it doesn't do it by default. Assuming that you have namespaces that push to handle wid's and that normally the current voc is the first in the search order: MY-NAMESPACE DEFINTIONS .... PREVIOUS DEFINITIONS. Much safer is CURRENT @ MY-NAMESPACE >WID CURRENT ! .... CURRENT ! This is however ciforth specific on half a dozen accounts. ALSO CURRENT CONTEXT are remnants of the time there were at most 2 namespaces in use at one time. clever person made it into a stack. Especially ALSO is confusing and should become obsolescent IMO. Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2015-02-17 12:54 +0000 |
| Message-ID | <2015Feb17.135426@mips.complang.tuwien.ac.at> |
| In reply to | #36621 |
empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> writes:
>I noticed usually ANS-compliant Forth implementations have doubled the first
>position in "Search order", like this (Gforth as example):
>
> order Forth Forth Root Forth ok
>
>1. Why is that? In case of need the first position can always be duplicated
> with ALSO, therefore why it's doubled by default (well, not always, tbh)?
The reason we do it in Gforth is such that programs that contain
idioms like
vocabluary foo
foo definitions
: bar ... ;
forth definitions
(i.e., classic fig-Forth days usage) work. Programs that use ALSO
still work, and I don't remember ever getting a report of program
failure because of the double occurence of FORTH.
It would have been nice if the Forth-94 was tighter in the description
of the default search order (and what the special parameters of
SET-ORDER mean), but our solution seems to work well anyway.
>2. And does that mean, that in case the word isn't found, text interpreter
> will search "Forth" vocabulary for the second time, although this one
> just has been searched with no success?
Depends on the implementation. In Gforth it does. One could change
the implementation to avoid that, but we have not yet found the need
to.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2014: http://www.euroforth.org/ef14/
[toc] | [prev] | [next] | [standalone]
| From | empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> |
|---|---|
| Date | 2015-02-17 18:38 +0000 |
| Message-ID | <slrnme72k9.7sh.empty.buffersYOU-DONT-WANT-THIS@Ferrycy.localdomain> |
| In reply to | #36636 |
In comp.lang.forth, Anton Ertl wrote:
> The reason we do it in Gforth is such that programs that contain
> idioms like
>
> vocabluary foo
> foo definitions
>: bar ... ;
> forth definitions
>
> (i.e., classic fig-Forth days usage) work. Programs that use ALSO
> still work, and I don't remember ever getting a report of program
> failure because of the double occurence of FORTH.
If I understood, the reason is, that - from what I see - in FIG-Forth
"foo" (from example above) sets itself as first position in search order,
but _not_ replacing present vocabulary "on top" ("built-in ALSO")?
--
- "I'll pulverize Trurl!" - said the machine - "But first, he'll tell me
how much two and two makes." [..]
- "Fo... that is, seven..."
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2015-02-18 11:31 +0000 |
| Message-ID | <2015Feb18.123119@mips.complang.tuwien.ac.at> |
| In reply to | #36639 |
empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> writes:
>In comp.lang.forth, Anton Ertl wrote:
>
>> The reason we do it in Gforth is such that programs that contain
>> idioms like
>>
>> vocabluary foo
>> foo definitions
>>: bar ... ;
>> forth definitions
>>
>> (i.e., classic fig-Forth days usage) work. Programs that use ALSO
>> still work, and I don't remember ever getting a report of program
>> failure because of the double occurence of FORTH.
>
>If I understood, the reason is, that - from what I see - in FIG-Forth
>"foo" (from example above) sets itself as first position in search order,
>but _not_ replacing present vocabulary "on top" ("built-in ALSO")?
fig-Forth has no search order in the Forth 94 sense. It has the
CONTEXT vocabulary, that'ss all. But CONTEXT always includes all the
words in FORTH (or is it the CONTEXT at the time of the definition of
the new vocabulary) at the time of the definition of the new
vocabulary (IIRC). So it's somewhat similar to having a search order
with 2 elements, with the bottom element being FORTH. Anyway, no
ALSO.
FOO would set itself as the new CONTEXT.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2014: http://www.euroforth.org/ef14/
[toc] | [prev] | [next] | [standalone]
| From | albert@spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2015-02-18 13:16 +0000 |
| Message-ID | <54e490ca$0$21336$e4fe514c@dreader37.news.xs4all.nl> |
| In reply to | #36649 |
In article <2015Feb18.123119@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> writes:
>>In comp.lang.forth, Anton Ertl wrote:
>>
>>> The reason we do it in Gforth is such that programs that contain
>>> idioms like
>>>
>>> vocabluary foo
>>> foo definitions
>>>: bar ... ;
>>> forth definitions
>>>
>>> (i.e., classic fig-Forth days usage) work. Programs that use ALSO
>>> still work, and I don't remember ever getting a report of program
>>> failure because of the double occurence of FORTH.
>>
>>If I understood, the reason is, that - from what I see - in FIG-Forth
>>"foo" (from example above) sets itself as first position in search order,
>>but _not_ replacing present vocabulary "on top" ("built-in ALSO")?
>
>fig-Forth has no search order in the Forth 94 sense. It has the
>CONTEXT vocabulary, that'ss all. But CONTEXT always includes all the
>words in FORTH (or is it the CONTEXT at the time of the definition of
>the new vocabulary) at the time of the definition of the new
>vocabulary (IIRC). So it's somewhat similar to having a search order
>with 2 elements, with the bottom element being FORTH. Anyway, no
>ALSO.
>
>FOO would set itself as the new CONTEXT.
While we are at it, has some one ever removed the wordlist
to which definitions are added (CURRENT I think) from the
search order, to arrive at a special effect in compilation?
Probably Forth is the only language were you can have
: aap bla .. bla ; \ definition of aap
: noot .. aap .. ; \ definition of noot
Where the second `` aap '' is not the one you just defined,
but from a stack of namespace ("wids") specified elsewhere.
(Java people would argue that at least the second aap should
be qualified with its namespace.)
Has anybody a use case for this, i.e. a situation where
it is essential that CURRENT and CONTEXT are different?
Personally I think it is so bad, that even the hideous
: noot ... [ ALSO AAP-NAMESPACE ] aap [ PREVIOUS ] .. ;
is to be preferred, even if that puts AAP-NAMESPACE in the
search-order twice.
>
>- anton
Groetjes Albert
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2015-02-18 14:00 +0000 |
| Message-ID | <2015Feb18.150022@mips.complang.tuwien.ac.at> |
| In reply to | #36653 |
albert@spenarnc.xs4all.nl (Albert van der Horst) writes:
>While we are at it, has some one ever removed the wordlist
>to which definitions are added (CURRENT I think) from the
>search order, to arrive at a special effect in compilation?
With SET-CURRENT you don't need to put it in the search order in the
first place. With DEFINITIONS you have to, but then you may be using
vocabularies that overwrite the top of the search order, so no need to
explicitly remove it, either. I.e.:
vocabulary assembler assembler definitions forth
>Has anybody a use case for this, i.e. a situation where
>it is essential that CURRENT and CONTEXT are different?
Some assemblers define words that are spelled exactly like standard
Forth words, e.g., AND XOR OR. And you may want to use the Forth
words while defining the assembler words, so you may want the
ASSEMBLER wordlist to be current, but not in the search order.
One other application I can imagine is that you define a wordlist of
aliases (e.g., for sealing), but use deferred words for the aliases.
Then you may want to have definitions like
defer foo ' foo is foo.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2014: http://www.euroforth.org/ef14/
[toc] | [prev] | [next] | [standalone]
| From | "Alex McDonald" <blog@rivadpm.com> |
|---|---|
| Date | 2015-02-18 16:44 +0000 |
| Message-ID | <mc2ff9$fe1$1@dont-email.me> |
| In reply to | #36654 |
on 18/02/2015 14:00:23, wrote: > albert@spenarnc.xs4all.nl (Albert van der Horst) writes: >>While we are at it, has some one ever removed the wordlist >>to which definitions are added (CURRENT I think) from the >>search order, to arrive at a special effect in compilation? > > With SET-CURRENT you don't need to put it in the search order in the > first place. With DEFINITIONS you have to, but then you may be using > vocabularies that overwrite the top of the search order, so no need to > explicitly remove it, either. I.e.: > > vocabulary assembler assembler definitions forth > >>Has anybody a use case for this, i.e. a situation where >>it is essential that CURRENT and CONTEXT are different? > > Some assemblers define words that are spelled exactly like standard > Forth words, e.g., AND XOR OR. And you may want to use the Forth > words while defining the assembler words, so you may want the > ASSEMBLER wordlist to be current, but not in the search order. The x86 assembler CMOVE (conditional MOV on flag EQ) caused me untold grief when I implemented it; until I realised that it was being redefined in the Forth wordlist rather than defined in the assembler wordlist.
[toc] | [prev] | [next] | [standalone]
| From | november.nihal@gmail.com |
|---|---|
| Date | 2015-02-17 07:13 -0800 |
| Message-ID | <f4386df3-c338-4d0c-b587-265b54377c6f@googlegroups.com> |
| In reply to | #36621 |
On Tuesday, 17 February 2015 00:46:46 UTC, empty-buffers wrote: > I noticed usually ANS-compliant Forth implementations have doubled the first > position in "Search order", like this (Gforth as example): > > order Forth Forth Root Forth ok > > 1. Why is that? In case of need the first position can always be duplicated > with ALSO, therefore why it's doubled by default (well, not always, tbh)? > > 2. And does that mean, that in case the word isn't found, text interpreter > will search "Forth" vocabulary for the second time, although this one > just has been searched with no success? > -- > - "I'll pulverize Trurl!" - said the machine - "But first, he'll tell me > how much two and two makes." [..] > - "Fo... that is, seven..." You might find the following thread useful.. https://groups.google.com/forum/#!searchin/comp.lang.forth/WORDLISTS/comp.lang.forth/hJg7qsOLJK0/hZPveitj4JgJ for (1) NN
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2015-02-17 08:21 -1000 |
| Message-ID | <EvWdnb9WUqIzG37JnZ2dnUU7-WudnZ2d@supernews.com> |
| In reply to | #36621 |
On 2/16/15 2:46 PM, empty-buffers wrote: > I noticed usually ANS-compliant Forth implementations have doubled the first > position in "Search order", like this (Gforth as example): > > order Forth Forth Root Forth ok > > 1. Why is that? In case of need the first position can always be duplicated > with ALSO, therefore why it's doubled by default (well, not always, tbh)? > > 2. And does that mean, that in case the word isn't found, text interpreter > will search "Forth" vocabulary for the second time, although this one > just has been searched with no success? > This question made me look up the Search Order wordset in Forth 200x (actually, Forth 200x Draft 12.1, which is the latest I have) and I noticed it had removed virtually all the rationale from Forth94 from this section. The question reinforces the fact that some rationale is needed here. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | "Alex McDonald" <blog@rivadpm.com> |
|---|---|
| Date | 2015-02-17 18:43 +0000 |
| Message-ID | <mc023i$tee$1@dont-email.me> |
| In reply to | #36638 |
on 17/02/2015 18:21:36, "Elizabeth D. Rather" wrote: > On 2/16/15 2:46 PM, empty-buffers wrote: >> I noticed usually ANS-compliant Forth implementations have doubled the first >> position in "Search order", like this (Gforth as example): >> >> order Forth Forth Root Forth ok >> >> 1. Why is that? In case of need the first position can always be duplicated >> with ALSO, therefore why it's doubled by default (well, not always, tbh)? >> >> 2. And does that mean, that in case the word isn't found, text interpreter >> will search "Forth" vocabulary for the second time, although this one >> just has been searched with no success? >> > > This question made me look up the Search Order wordset in Forth 200x > (actually, Forth 200x Draft 12.1, which is the latest I have) and I > noticed it had removed virtually all the rationale from Forth94 from > this section. The question reinforces the fact that some rationale is > needed here. > > Cheers, > Elizabeth > The ANS version is longer, but it doesn't seem to add much except for a historical perspective.
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2015-02-17 11:59 -1000 |
| Message-ID | <wI-dnTEDrZk5JH7JnZ2dnUU7-S-dnZ2d@supernews.com> |
| In reply to | #36640 |
On 2/17/15 8:43 AM, Alex McDonald wrote: > on 17/02/2015 18:21:36, "Elizabeth D. Rather" wrote: >> On 2/16/15 2:46 PM, empty-buffers wrote: >>> I noticed usually ANS-compliant Forth implementations have doubled the first >>> position in "Search order", like this (Gforth as example): >>> >>> order Forth Forth Root Forth ok >>> >>> 1. Why is that? In case of need the first position can always be duplicated >>> with ALSO, therefore why it's doubled by default (well, not always, tbh)? >>> >>> 2. And does that mean, that in case the word isn't found, text interpreter >>> will search "Forth" vocabulary for the second time, although this one >>> just has been searched with no success? >>> >> >> This question made me look up the Search Order wordset in Forth 200x >> (actually, Forth 200x Draft 12.1, which is the latest I have) and I >> noticed it had removed virtually all the rationale from Forth94 from >> this section. The question reinforces the fact that some rationale is >> needed here. >> >> Cheers, >> Elizabeth >> > > The ANS version is longer, but it doesn't seem to add much except for a > historical perspective. > That can be useful, particularly for people who have been looking at FIG Forth, including some in this thread. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2015-02-17 18:30 -0800 |
| Message-ID | <38251528-b084-421d-881c-6b50c70996ea@googlegroups.com> |
| In reply to | #36638 |
On Tuesday, February 17, 2015 at 11:21:36 AM UTC-7, Elizabeth D. Rather wrote: > On 2/16/15 2:46 PM, empty-buffers wrote: > > I noticed usually ANS-compliant Forth implementations have doubled the first > > position in "Search order", like this (Gforth as example): > > > > order Forth Forth Root Forth ok > > > > 1. Why is that? In case of need the first position can always be duplicated > > with ALSO, therefore why it's doubled by default (well, not always, tbh)? > > > > 2. And does that mean, that in case the word isn't found, text interpreter > > will search "Forth" vocabulary for the second time, although this one > > just has been searched with no success? > > > This question made me look up the Search Order wordset in Forth 200x > (actually, Forth 200x Draft 12.1, which is the latest I have) and I > noticed it had removed virtually all the rationale from Forth94 from > this section. The question reinforces the fact that some rationale is > needed here. Maybe the reason why the rationale was removed from the ANS-Forth document was because there was no rationalization for your decision --- "rational" implies thinking, which is not your forte. Read this thread (dated 1993, one year prior to ANS-Forth being written in stone): https://groups.google.com/forum/#!topic/comp.lang.forth/olO-VHXJa1Q%5B1-25-false%5D Ray Duncan describes the infamous Ragsdale ALSO/ONLY system as being "severely brain-dead." Apparently Elizabeth Rather's "rationale" didn't impress him very much. After ANS-Forth came out, Ray Duncan abandoned Forth altogether, apparently considering ANS-Forth to mark the end of Forth --- although Elizabeth Rather lists his name in the ANS-Forth document as a contributor and supporter of ANS-Forth --- she is just trying to steal his fame for UR/Forth, which was the primary professional Forth system available during the MS-DOS era. In this thread I provided a work-around to ALSO --- I consider ALSO to be a very screw-ball idea, and I don't use it at all --- I discuss this in that thread.
[toc] | [prev] | [next] | [standalone]
| From | JennyB <jennybrien@googlemail.com> |
|---|---|
| Date | 2015-02-18 04:01 -0800 |
| Message-ID | <7ae4cc72-6090-45f7-8cbc-4d290b8831d3@googlegroups.com> |
| In reply to | #36643 |
On Wednesday, 18 February 2015 02:30:29 UTC, hughag...@gmail.com wrote:
> Read this thread (dated 1993, one year prior to ANS-Forth being written in stone):
> https://groups.google.com/forum/#!topic/comp.lang.forth/olO-VHXJa1Q%5B1-25-false%5D
You seem to have got the reference wrong; that links to a discussion of SMUDGE.
AIUI, the history went something like this:
In the beginning there was only the FORTH vocabulary, in which all words were defined. Others were needed; for instance, it was common practice to have an assembler written in Forth so that you could add low-level words, and you didn't want all those mnemonics in the main vocabulary.
So now there had to be a distinction between the CURRENT vocabulary in which new words were defined, and the CONTEXT, which was the vocabulary searched. You could still only search one vocabulary at a time. It made sense for a Vocabulary to set itself as the CONTEXT, overwriting what was there before, and for DEFINITIONS to set the CURRENT vocabulary to be whatever was in CONTEXT.
So writing a assembler went something like this:
VOCABULARY ASSEMBLER
ASSEMBLER DEFINITIONS
FORTH \ ASSEMBLER is now CURRENT, and FORTH is CONTEXT
: OPCODETYPE1 CREATE ... DOES> ... ; etc.
\ the assembler works while interpreting, not while compiling
nnn opcodetype1 FOO etc.
FORTH DEFINITIONS
: CODE CREATE ... ASSEMBLER ;
: END-CODE ... FORTH ;
To change the CONTEXT in the middle of a definition you enclosed the vocabulary in [ ]. Thus, to write an assembler macro:
: MACROFOO forth words [ ASSEMBLER ] opcodes [ FORTH ] ;
Which worked, but it was verbose and you had to be sure what CONTEXT was at all times, and sometimes you had to redefine words in another CONTEXT to make suer you could use them when you needed them. To get round this some implementers defined Vocabularies so that they linked to other vocabularies, and many defined : so that it set the CONTEXT vocabulary to whatever was CURRENT.
It was a mess.
ALSO/ONLY was quite a brilliant solution for its time. It made the single CONTEXT variable into a stack, by saying in effect "search this vocabulary first, and then whatever was in CONTEXT before" And all the old CONTEXT-switching code still worked.
That's why, now that we have an explicit Search Order, Vocabularies overwrite the top item instead of pushing themselves onto the stack.
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2015-02-18 18:13 -0800 |
| Message-ID | <01f082dd-0f1d-49a1-874e-62c03204db96@googlegroups.com> |
| In reply to | #36650 |
On Wednesday, February 18, 2015 at 5:01:09 AM UTC-7, JennyB wrote:
> On Wednesday, 18 February 2015 02:30:29 UTC, hughag...@gmail.com wrote:
>
> > Read this thread (dated 1993, one year prior to ANS-Forth being written in stone):
> > https://groups.google.com/forum/#!topic/comp.lang.forth/olO-VHXJa1Q%5B1-25-false%5D
>
> You seem to have got the reference wrong; that links to a discussion of SMUDGE.
Keep reading --- the subject matter changes to vocabularies (subject changes were common on C.L.F. 20 years ago too, apparently).
> AIUI, the history went something like this:
>
> In the beginning there was only the FORTH vocabulary, in which all words were defined. Others were needed; for instance, it was common practice to have an assembler written in Forth so that you could add low-level words, and you didn't want all those mnemonics in the main vocabulary.
>
> So now there had to be a distinction between the CURRENT vocabulary in which new words were defined, and the CONTEXT, which was the vocabulary searched. You could still only search one vocabulary at a time. It made sense for a Vocabulary to set itself as the CONTEXT, overwriting what was there before, and for DEFINITIONS to set the CURRENT vocabulary to be whatever was in CONTEXT.
>
> So writing a assembler went something like this:
>
> VOCABULARY ASSEMBLER
> ASSEMBLER DEFINITIONS
>
> FORTH \ ASSEMBLER is now CURRENT, and FORTH is CONTEXT
>
> : OPCODETYPE1 CREATE ... DOES> ... ; etc.
>
> \ the assembler works while interpreting, not while compiling
>
> nnn opcodetype1 FOO etc.
>
> FORTH DEFINITIONS
>
> : CODE CREATE ... ASSEMBLER ;
> : END-CODE ... FORTH ;
>
> To change the CONTEXT in the middle of a definition you enclosed the vocabulary in [ ]. Thus, to write an assembler macro:
>
> : MACROFOO forth words [ ASSEMBLER ] opcodes [ FORTH ] ;
>
> Which worked, but it was verbose and you had to be sure what CONTEXT was at all times, and sometimes you had to redefine words in another CONTEXT to make suer you could use them when you needed them. To get round this some implementers defined Vocabularies so that they linked to other vocabularies, and many defined : so that it set the CONTEXT vocabulary to whatever was CURRENT.
>
> It was a mess.
The very early Forths did a search of these vocabularies in this order:
1.) CONTEXT
2.) CURRENT
3.) FORTH
This was a big mistake, and so this was done instead in Forth-83 (Forth-79 too, IIRC):
1.) CONTEXT
2.) FORTH
I wrote the MFX cross-compiler in UR/Forth using this system --- it worked fine --- the only feature that I wasn't able to implement, was to have vocabularies in the HOST and TARG code that the user writes (I can have this feature now though).
> ALSO/ONLY was quite a brilliant solution for its time. It made the single CONTEXT variable into a stack, by saying in effect "search this vocabulary first, and then whatever was in CONTEXT before" And all the old CONTEXT-switching code still worked.
>
> That's why, now that we have an explicit Search Order, Vocabularies overwrite the top item instead of pushing themselves onto the stack.
If you do continue reading, you will get to where I make these statements:
On Friday, October 3, 2014 at 5:40:50 PM UTC-7, hughag...@yahoo.com wrote:
> On Friday, October 3, 2014 4:30:47 PM UTC-7, Gerry wrote:
> > Investigating further reveals inconsistent behaviour:
> > : x { y } [ order previous order ] ;
> > LOCALVARS FORTH EXTERNALS ROOT
> > Current: FORTH
> >
> > FORTH EXTERNALS ROOT
> > Current: FORTH
> > ok
> >
> > shows that the LOCALSVAR wordlist is removed by PREVIOUS.
>
> This is what I said above regarding 13.3.3-1.
>
> > However going back to the first definition and looking at the search
> > order after it fails to compile:
> >
> > : foo { bar } bar . [ previous ] bar . ;
> > Err# -13 ERR: Undefined word.
> > -> : foo { bar } bar . [ previous ] bar . ;
> >
> > order
> > EXTERNALS ROOT
> > Current: FORTH
> > ok
> >
> > It seems to have removed the Forth wordlist as well as the LOCALSVAR
> > wordlist.
>
> If your "it" referred to PREVIOUS, that is unlikely --- I don't think this is inconsistent --- more likely, it was QUIT that was called due to the crash, and it did an ONLY. I think that it is okay for QUIT to do ONLY because we want to get back to a rational state. I do wonder at why ONLY doesn't leave FORTH on the top of the search-order though --- putting us back in the REPL without FORTH in the search-order is not exactly putting us in a "rational state."
and:
On Saturday, October 4, 2014 at 9:14:07 PM UTC-7, hughag...@yahoo.com wrote:
> Wordlists are a bad design ("severely brain-damaged" in Ray Duncan's words). This is because ALSO duplicates the 1st wid of the search-order, which makes no sense. Forth is supposed to be context-free, but ALSO only makes sense in the context of being followed immediately by FORTH or some such word that replaces the 1st wid of the search-order with a new wid. This is a violation of the idea that Forth should not have any syntax --- exceptions are IF THEN etc. that have to be used in relation to each other --- but, for the most part, words are not supposed to require other words to fix what they left in a damaged state (which is what ALSO does).
[toc] | [prev] | [next] | [standalone]
| From | "HAA" <someone@microsoft.com> |
|---|---|
| Date | 2015-02-28 11:35 +1100 |
| Message-ID | <mcr35t$6j3$1@speranza.aioe.org> |
| In reply to | #36674 |
hughaguilar96@gmail.com wrote: > ... > The very early Forths did a search of these vocabularies in this order: > 1.) CONTEXT > 2.) CURRENT > 3.) FORTH > > This was a big mistake, and so this was done instead in Forth-83 (Forth-79 too, IIRC): > 1.) CONTEXT > 2.) FORTH AFAIK Forth-79 search order was CONTEXT FORTH. Forth-83 loosely defined search order as 'beginning with the last vocabulary invoked and ending with FORTH'.
[toc] | [prev] | [next] | [standalone]
| From | "Alex McDonald" <blog@rivadpm.com> |
|---|---|
| Date | 2015-02-18 12:34 +0000 |
| Message-ID | <mc20qp$kaa$1@dont-email.me> |
| In reply to | #36643 |
on 18/02/2015 02:30:28, wrote: > On Tuesday, February 17, 2015 at 11:21:36 AM UTC-7, Elizabeth D. > Rather wro te: >> On 2/16/15 2:46 PM, empty-buffers wrote: >> > I noticed usually ANS-compliant Forth implementations have doubled the > first >> > position in "Search order", like this (Gforth as example): >> > >> > order Forth Forth Root Forth ok >> > >> > 1. Why is that? In case of need the first position can always be duplic > ated >> > with ALSO, therefore why it's doubled by default (well, not always, > tbh)? >> > >> > 2. And does that mean, that in case the word isn't found, text interpre > ter >> > will search "Forth" vocabulary for the second time, although this o > ne >> > just has been searched with no success? >> > > >> This question made me look up the Search Order wordset in Forth 200x >> (actually, Forth 200x Draft 12.1, which is the latest I have) and I >> noticed it had removed virtually all the rationale from Forth94 from >> this section. The question reinforces the fact that some rationale is >> needed here. > > Maybe the reason why the rationale was removed from the ANS-Forth > document was because there was no rationalization for your decision > --- "rational" i mplies thinking, which is not your forte. Ugly, ugly, ugly. A person with any moral character wouldn't say that. > > Read this thread (dated 1993, one year prior to ANS-Forth being > written in stone): > https://groups.google.com/forum/#!topic/comp.lang.forth/olO-VHXJa1Q%5B1-25- > false%5D Ray Duncan describes the infamous Ragsdale ALSO/ONLY system > as being "sever ely brain-dead." Your link doesn't work. And when reconstructed, it points to a 126 post thread that starts with a discussion of SMUDGE. Much as I like you, I draw the line at doing your homework. > Apparently Elizabeth Rather's > "rationale" didn't impress h im very much. After ANS-Forth came out, > Ray Duncan abandoned Forth altogeth er, apparently considering > ANS-Forth to mark the end of Forth --- Evidence please, since saying "apparently" twice doesn't cut it. It would be the committee's rationale, and there may even be a record of the voting in the JFAR documents of the X3J14 meetings that Stephen Pelc has on his website. You might want to refer to them. Assuming you can get your head out of your ass, that is. And try quoting since your links are all borked. > although Elizabeth Rather lists > his name in the ANS-Forth document as a contributor and supporter of > ANS-Forth --- she is just trying to steal his fame for UR/ Forth, > which was the primary professional Forth system available during the > MS-DOS era. ANS documents list those that were on the committee. Equally, no-one who qualifies but does not want to be on the contributor list can be put there against their will. That's an ANS policy. It has nothing to do with the chair. That's whay it doesn't include any old random off the street; you're not on it for that very reason. Though given the amount of effort you've put into crapping all over it since you discovered Elizabreth Rather was mentioned in it, perhaps you should be added retrospectively. If you ask her nicely I'm sure she'll get you on it, as she can apparently do any number of impossible things. > > In this thread I provided a work-around to ALSO --- I consider ALSO to > be a very screw-ball idea, and I don't use it at all --- I discuss > this in that thread. > Do your homework properly, post it here.
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2015-02-18 12:28 +0000 |
| Message-ID | <2015Feb18.132855@mips.complang.tuwien.ac.at> |
| In reply to | #36638 |
"Elizabeth D. Rather" <erather@forth.com> writes:
>On 2/16/15 2:46 PM, empty-buffers wrote:
>> I noticed usually ANS-compliant Forth implementations have doubled the first
>> position in "Search order", like this (Gforth as example):
>>
>> order Forth Forth Root Forth ok
>>
>> 1. Why is that? In case of need the first position can always be duplicated
>> with ALSO, therefore why it's doubled by default (well, not always, tbh)?
>>
>> 2. And does that mean, that in case the word isn't found, text interpreter
>> will search "Forth" vocabulary for the second time, although this one
>> just has been searched with no success?
>>
>
>This question made me look up the Search Order wordset in Forth 200x
>(actually, Forth 200x Draft 12.1, which is the latest I have)
You can find more recent drafts at:
http://www.forth200x.org/documents/, in particular
http://www.forth200x.org/documents/forth-2012.pdf
> and I
>noticed it had removed virtually all the rationale from Forth94 from
>this section. The question reinforces the fact that some rationale is
>needed here.
I don't think that the Forth-94 rationale gave any real insights into
the questions above. Despite all the rationale in Forth-94, it was
unclear what the default search order should be, in particular whether
we should have "Forth Root" or "Forth Forth Root"; so it also gives no
explanation of why we chose "Forth Forth Root".
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2014: http://www.euroforth.org/ef14/
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.forth
csiph-web