On Tuesday, March 13, 2018 at 12:37:15 PM UTC+1, Anton Ertl wrote:
>
minf...@arcor.de writes:
> >Would make sense but a bit convoluted:
> >If the SEARCH wordlist is present, let SEARCH-WORDLIST do a case-insensitiv=
> >e
> >search i.e. dup DuP DUP will all be found when wid =3D FORTH-WORDLIST.
> >For any other wid do a case-sensitive search.
>
> The mainstream systems use case-insensitive search for all wordlists,
> and many programs have an environmental dependency on
> case-insensitivity for all wordlists. In Gforth WORDLIST produces
> case-insensitive wordlist, but it also has TABLE and now CS-WORDLIST
> that create case-sensitive wordlists. The difference between TABLE
> and CS-WORDLIST is that words in TABLEs are not LOCATEable etc.
iForth has the CASESENSITIVE variable. I find it hard to grasp
what is meant when somebody says their system is casesensitive,
so here's an example:
FORTH> casesensitive ? 0 ok
FORTH> ' DUP . 19141584 ok
FORTH> ' dup . 19141584 ok
FORTH> ' DuP . 19141584 ok
FORTH> casesensitive on ok
FORTH> ' DUP . 19141584 ok
FORTH> ' dup .
Error -13
dup ?
The underlying implementation searches
the dictionaries twice (typically it takes
only two probes to find a word). Words are
entered in the dictionary exactly as written.
For my work, I frequently need to specify
if words are found considering case or not.
This has resulted in iForth having SEARCH-NC
and COMPARE-NC.
To specify filenames it is necessary to have
case-sensitive input. It is also handy in a
metacompiler or when writing parsers for
other languages.
I do not like source code in all lower or upper
case. Over the years it has proved to be most
efficient to write Forth words exactly as spelled
in the standard. (This is not exactly a popular
format.) Constants are (mostly) uppercase and
variables (mostly) lowercase.
-marcel