Re: namespace collisions

Liste des GroupesRevenir à cl forth 
Sujet : Re: namespace collisions
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forth
Date : 02. Feb 2025, 12:25:39
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$737285a4$39682333@a1319b1658280e0a>
References : 1
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <87h65dxk7c.fsf@nightsong.com>,
Paul Rubin  <no.email@nospam.invalid> wrote:
In Haskell, if you import packages X and Y, and X contains a symbol
"foo", you can refer to it as just "foo" or explicitly as X.foo.
>
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?

No special measures are required.
You look `fun up in the current search order, and say "isn't unique"
You look `fun up in the all wordlists, and say "isn't globally unique".

In ciforth you have an iterator for namespace (VOCABULARY's) e.g.
\ Print all namespace (voc) names in existence.
: .VOCS 'ID. FOR-VOCS ;

Now replace the execution token ID. by a word using SEARCH-WORDLIST .

You ask for something simple.
That is neither here nor there.
Use a simple Forth, then it is easy.
If you use a difficult Forth, all tasks are difficult.

>
Thanks.

Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.

Date Sujet#  Auteur
2 Feb 25 * namespace collisions4Paul Rubin
2 Feb 25 +* Re: namespace collisions2Anton Ertl
2 Feb 25 i`- Re: namespace collisions1Paul Rubin
2 Feb 25 `- Re: namespace collisions1albert

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal