I wonder how difficult it would be to introduce rudimentary namespaces into #elisp.

#emacs

@me I guess you could fairly easily write a macro that automatically created a lexical scope and added some prefixes to variable used within its body - Doug Hoyte's "Let over lambda" book has #CommonLisp examples of this kind of approach as way to cut down the syntactic overhead of using gensym in macros. Without much thought, I'd assume something similar could be done in #EmacsLisp

@tealeg I'm thinking something a little more robust involving using a symbol's property list to store everything contained within that namespace.

I'm probably biting off more than I can chew at this point in my understanding of elisp, but I'm sure this idea will stick around in my brain until I have enough of an understanding to pull it (or something comparable) off.

...or I find some already existing thing that does what I want (which is more likely).

@me SBCL, for example, has the in-package macro set the value of the special variable *PACKAGE* which, I guess, would then ultimately get used in every definition and reference.

@tealeg @me

Just a sidenote, but `in-package' and Co. are Common Lisp things, not just SBCL's.
And `*package*' is mainly used by the reader.

#CommonLisp

@vnikolov @me the specific macro expansion can differ though, right?

Really I was just quickly checking by doing `(macroexpand ‘(in-package foo))`, I never really thought much about the implementation before now.

@tealeg @me

tealeg@mastodon.online> the specific macro expansion can differ though, right?

Yes, and it often does (and it may well contain implementation-specific items, of course).

And `macroexpand' is certainly a good way to explore things; just consult the specification as well (in this case the excellent Hyperspec, CLHS).

#CommonLisp
#CommonLispHyperSpec