Sujet : Re: namespace collisions
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 02. Feb 2025, 08:28:04
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Feb2.082804@mips.complang.tuwien.ac.at>
References : 1
User-Agent : xrn 10.11
Paul Rubin <
no.email@nospam.invalid> writes:
If both X and Y contain foo, then saying just "foo" is ambiguous and the
compiler flags it as an error. You are required to say X.foo or Y.foo
to indicate which one you want.
>
Is there a simple way to do something like that in Forth, to get an
error or at least a warning, if the same symbol occurs in multiple
wordlists in the search order?
If your Forth system supports recognizers, you can replace the name
recognizer with one that searches the whole search order instead of
stopping at the first match, and then prints a warning if there is
more than one match, and returns the first match.
Of course that only produces a warning if you actually access FOO
(unlike what you specified), but I think it's the same for Haskell.
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/EuroForth 2023 proceedings: http://www.euroforth.org/ef23/papers/EuroForth 2024 proceedings:
http://www.euroforth.org/ef24/papers/