From Newsgroup: comp.lang.forth
[email protected] writes:
What is the use case for SLITERAL.
: test [ "AAP" ] SLITERAL ;
...
: test "AAP" ;
I.e. SLITERAL is not useful for this purpose.
I can't think if a case where SLITERAL is *not* preceeded by
[ ] because : is allowed to leave colon-sys .
The Gforth source code contains the following occurences:
kernel/quotes.fs:74:28: :noname '"' parse postpone SLiteral ; kernel/quotes.fs:88:28: :noname '"' parse postpone SLiteral postpone type ; utf-8.fs:330:55: r> I delta-I [ #cr pad c! #lf pad 1+ c! pad 2 ] SLiteral string-prefix? -
utf-8.fs:348:55: r> I delta-I [ #cr pad c! #lf pad 1+ c! pad 2 ] SLiteral string-prefix? -
quotes.fs:144:63: :noname ['] singleline-string \"-parse save-mem 2dup postpone sliteral drop free throw ;
ekey.fs:302:27: [ pad 3 $80 fill pad 3 ] SLiteral
rec-string.fs:37:14: postpone sliteral ;
libcc.fs:944:4: ] sliteral
libcc.fs:955:4: ] sliteral
libcc.fs:965:81: libtool-cc $type libtool-flags $type s" -module -rpath " $type tmp$ $@ ] sliteral type
libcc.fs:1170:45: 2drop [ s" libccdir" getenv ':' 0 substc ] SLiteral locate1.fs:658:28: :noname '`' parse postpone SLiteral postpone sh-get ;
5 uses without preceding ], all of those preceded by POSTPONE.
Those with preceding ] tend to have their strings stored in volatile
storage.
The usage at quotes.fs:144:63 makes me wonder; first the string is
SAVE-MEMed (stored on the heap), then SLITERALed, and then the heap
storage is freed. Maybe the expectation was that \"-PARSE stores the
string in a place that SLITERAL may overwrite. Maybe that's no longer
the case.
- 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:
https://forth-standard.org/
EuroForth 2025 CFP:
http://www.euroforth.org/ef25/cfp.html
EuroForth 2025 registration:
https://euro.theforth.net/
--- Synchronet 3.21a-Linux NewsLink 1.2