Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #10680
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Subject | Re: Why the difference? |
| Newsgroups | comp.lang.forth |
| Message-ID | <57639502998435@frunobulax.edu> (permalink) |
| Date | 2012-04-01 08:40 +0200 |
| References | <slrnjnfjl5.c22.zbigniew2011REMOVE@Tichy.myhome.org> |
| Organization | Wanadoo |
Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> writes Re: Why the difference?
> Noticed, that not every Forth accepts direct use of "BL WORD", I mean:
> #v+
> : test ( -- ) bl word count type ; ok
> test abc abc ok
> bl word abc count type abc ok
> #v-
> Both ways of "printing the next word taken from input stream" seem equally
> valid, but some Forth-variants don't like that latter, "interactive one".
> Why?
FORTH> help WORD
WORD CORE
( char "ccc<char>" -- c-addr )
char is a single character delimiter. Parse characters ccc delimited by
char, ignoring leading delimiters. An ambiguous condition exists if the
length of the parsed string is greater than the implementation-defined
length of a counted string.
c-addr is the address of a transient region containing the parsed word
as a counted string. If the current input stream was empty or contained
no characters other than the delimiter, the resulting string has a zero
count. A space, not included in the count, follows the string.
Note: The requirement to follow the string with a space is obsolescent
and is included as a concession to existing programs that use CONVERT .
A standard program may not depend on the existence of the space.
The problem is caused by what "c-addr is the address of a transient region
containing the parsed word" means on a specific system. In conventional
systems *all* parsed words, even those parsed by the text interpreter itself,
are copied to this transient area. Therefore when TYPE executes, the string
in the transient area is not "abc," but "type".
In the text interpreter does not use WORD itself, or makes an exception for
WORD to circumvent exactly your problem.
-marcel
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why the difference ("BL WORD")? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2012-04-01 03:37 +0100
Re: Why the difference? mhx@iae.nl (Marcel Hendrix) - 2012-04-01 08:40 +0200
Re: Why the difference ("BL WORD")? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-31 21:14 -1000
Re: Why the difference ("BL WORD")? Zbiggy <zbigniew2011REMOVE@gmail.REMOVE.com> - 2012-04-01 12:39 +0100
Re: Why the difference ("BL WORD")? BruceMcF <agila61@netscape.net> - 2012-04-01 09:39 -0700
Re: Why the difference ("BL WORD")? "Peter Knaggs" <pjk@bcs.org.uk> - 2012-04-01 11:53 +0100
Re: Why the difference ("BL WORD")? Coos Haak <chforth@hccnet.nl> - 2012-04-02 00:37 +0200
Re: Why the difference ("BL WORD")? BruceMcF <agila61@netscape.net> - 2012-03-31 19:37 -0700
csiph-web