[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jan 25 16:12:02 1994 
Subject:Re: valof evil ?! 
From:jlc (Jonathan Cunningham) 
Volume-ID:940125.04 

> > ..Well
> > that's all right, too.  It is simply more complex than the alternative
> > outlined below.
> 
> No. It's very simple. Just choose your identifiers carefully. This is a
> problem that you can't get round just by using sections: any package of
> the sort you are talking about, must be accessible to the other code. So
> there has to be at least in part a common name space, and if you use
> sections or packages all you are doing is making the name space (for
> exported identifiers) richer by having names composed of section name
> plus variable name. It's still possible for someone else to choose the

Renaming one section lets you rename all the exported identifiers in
one swell foop. So probably the only real risk is that two sections share
the same name: this is a much smaller risk than for variables.

Actually, given that sections are horrid, I would abolish them[1]. I think
the main purpose (hiding names) is now sufficiently served by lexical
scoping for most purposes. To resolve name clashes between libraries,
I would suggest a mechanism for systematically renaming global variables
(usually function definitions) after loading (this could easily be
implemented using -appdic-, -syssynonym- and -syscancel-). Much less
yuckier than sections. For example, instead of

    : lib rhubarb;

you could optionally do

    : prefixload 'rhubarb_' lib rhubarb;

and any global identifiers declared in lib rhubarb would be renamed
automatically to have a 'rhubarb_' prefix.

Jonathan Cunningham

[1] I faintly remember someone (Steve Knight? Scott Wheeler?) fulminating
on about the distinction between scoping and name-space control the last
time I made this suggestion, suggesting that some kind of section
mechanism (module, package etc.) was actually necessary. Since I can't
remember the argument, it obviously didn't convince me! :-). But I
would be happy to see the argument rehashed(!) for the benefit of new
readers.

--jlc