emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding namespaces to emacs-lisp (better elisp?)


From: Davis Herring
Subject: Re: adding namespaces to emacs-lisp (better elisp?)
Date: Fri, 26 Jul 2013 11:21:10 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110717 Lanikai/3.1.11

> - I'm not sure how well it will cope with shadowing and non-namespaced
>   symbols (e.g. symbols like `face' that aren't used as variables).
>   The rule "global obarray is inspected first and if a symbol is found
>   there that's what is used" means that we have to be vary careful about
>   interning things in the global obarray since it can affect the way
>   other code is handled.  Currently, we're very liberal about interning
>   in the global obarray.
>   Basically I think this shadowing rule makes things a bit too automatic
>   for something where we need more control.
>   I think that, for backward compatibility reasons we can't easily mark
>   "non-prefixed symbols that should be global" (such as `face'), so the
>   safer alternative is to force local symbols to be specially marked
>   (like ::foo, maybe, to mean "foo in the current local obarray").
>   Having to prefix every single local symbol that way probably sounds
>   rather unpalatable, tho.

I think Mathematica's solution here works pretty well (see
http://reference.wolfram.com/mathematica/tutorial/Contexts.html).  The
part I think relevant here would be to define a "built-in" namespace
that would be searched first (like the global obarray mentioned above),
but not have it be the default for namespace-oblivious code.  Then the
up-front cost would be merely that symbols like 'face (as well as more
obvious things like 'car) would need to be explicitly placed in that
special namespace, rather than that all references to them needing
modification.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]