[Top][All Lists]

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

Re: Proper namespaces in Elisp

From: Daniel Colascione
Subject: Re: Proper namespaces in Elisp
Date: Thu, 7 May 2020 13:42:46 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 5/7/20 1:28 PM, Stefan Monnier wrote:
I don't like reader magic. It complicates code logic. I know we talked about
symbol-macrolet and macrolet as possible options and know why neither is
quite the right thing, but I still think that a macro of the same general
kind would work fine. Macros don't need to recognize defining forms if they
macroexpand their bodies before walking them.

You need not only discover the defining forms but also the "using"
forms.  So you need to know that the arguments to `make-local-variable`,
`add-hook`, `symbol-value`, `facep`, ... (and all function that pass
their arg to one of those) are not just random symbols (that you should
leave untouched) but symbols that obey the namespace rules.

I think these situations are rare enough that we can ask people to pass fully-qualified symbols.

In Common Lisp, the distinction is made by using keywords instead of
normal symbols when the namespace rules shouldn't apply, but Elisp
doesn't have such a tradition.

Common Lisp does deal with this problem in some cases, e.g., in LOOP. We should be moving forwards keywords anyway.

FWIW, I think elisp should just literally copy Common Lisp's approach. It's tried and tested, and the pitfalls are well-understood. It'll take a while to work the kinks out of a bespoke approach, and the CL approach seems adequate for addressing the problem that people are trying to solve.

reply via email to

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