Re: modular programming in Forth
- From: BruceMcF <agila61@xxxxxxxxxxxx>
- Date: Sun, 9 Oct 2011 17:41:40 -0700 (PDT)
On Oct 9, 3:50 pm, Krishna Myneni <krishna.myn...@xxxxxxxxxxx> wrote:
Ah, so the only point of agreement I thought we had, really isn't.
I'm not sure where you got the idea I wanted to have to include a
module file, then define the public interface out into the actual
target namespace with a bunch of
: foo foo ;
: bar bar ;
...
.... definitions. The public words in that included file *ought* to
show up in the namespace that receives definitions when I include it.
Offhand I don't agree that the module name should provide the private
wordlist. What you describe is an anonymous module with a named
private wordlist.
A fairly misleading description ~ in the original anonymous module,
the private was necessarily anonymous, but as I noted, whether the
public is anonymous or not is left up to the includer.
More descriptive is inherited public, named private. Forth Inc. has
found that that suffices where public / private definitions are
required, and it avoids multiple complexities that might be fun to
solve, but impose unnecessary restrictions on the users.
If NAME-PRIVATE: is added to my existing module.fs,
it would provide the same functionality.
Except NAME-PRIVATE: does *not* provide the same functionality *in
practice*, since it only works without editing for those modules where
the *author* can envision some purpose for later access to the private
words: it doesn't work for any private namespace where the *user*
comes across a purpose at hand.
The library module author ensuring that the only word conflicts that
*have* to be accommodated is the public interface ~ that's a feature.
The library module author denying me the use of some unanticipated use
of his code ~ that's a bug.
And while having the public interface for each module sealed off in a
distinct named wordlist is inconvenient for most users, the flipside
is the ability to detect whether the module has been loaded at all ~
so inheriting the public namespace and naming the private namespace
kills three birds with one stone ~ maximum compatibility with the host
system approach to namespace management, being open to unanticipated
re-use of existing code, and a name at the module level which, if
distinct names are given to distinct versions of a module, can be used
to detect whether the required version of the module is available.
.
- References:
- modular programming in Forth
- From: Krishna Myneni
- Re: modular programming in Forth
- From: Krishna Myneni
- Re: modular programming in Forth
- From: BruceMcF
- Re: modular programming in Forth
- From: Krishna Myneni
- Re: modular programming in Forth
- From: BruceMcF
- Re: modular programming in Forth
- From: Krishna Myneni
- Re: modular programming in Forth
- From: BruceMcF
- Re: modular programming in Forth
- From: Krishna Myneni
- Re: modular programming in Forth
- From: BruceMcF
- Re: modular programming in Forth
- From: Krishna Myneni
- Re: modular programming in Forth
- From: BruceMcF
- Re: modular programming in Forth
- From: Krishna Myneni
- modular programming in Forth
- Prev by Date: Re: modular programming in Forth
- Next by Date: Re: modular programming in Forth
- Previous by thread: Re: modular programming in Forth
- Next by thread: Re: modular programming in Forth
- Index(es):
Relevant Pages
|