Open phoe opened 2 years ago
would you check if Trivia and couple of other dependent libraries builds with this version of lisp-namespace?
suggestion --- if you are so scared about UB in describe-object, how about adding a message in the output of describe-object, like this: "Note: If you are surprised by the fact that your describe-object :after method is not working as you expected, this is me, lisp-namespace library, who is overwriting it https://github.com/guicho271828/lisp-namespace . Make sure you overwrite me."
And just to note, while I believe "namespace" is still a nice concept, I wouldn't try to make it too fancy because it is just a hash table.
would you check if Trivia and couple of other dependent libraries builds with this version of lisp-namespace?
Trivia seems to load fine; I'll make a Quicklisp ticket to check if the Quicklisp world builds with this change.
And just to note, while I believe "namespace" is still a nice concept, I wouldn't try to make it too fancy because it is just a hash table.
The underlying implementation is just a hashtable, but the concept itself, plus the option to automatically define accessors, is actually pretty fancy. I'm working on the second edition of Common Lisp Recipes and I want to put a recipe about namespaces there, which is also the reason why I've spent some code on polishing/rewriting lisp-namespace
.
if you are so scared about UB in describe-object
I guess I'm not too scared at the moment - the current safeguard seems to work:
CL-USER> (defmethod describe-object :after (object stream)
(print "haha" stream))
#<STANDARD-METHOD COMMON-LISP:DESCRIBE-OBJECT :AFTER (T T) {1011B042F3}>
CL-USER> (asdf:load-system :in-nomine)
WARNING:
A previous DESCRIBE-OBJECT :AFTER (T T) method which was not defined by IN-NOMINE already exists; IN-NOMINE will NOT overwrite it with a custom method.
T
So if any method already exists there, it won't be overwritten, and instead a compile-time warning will get signaled. This, and describe
isn't usually used in programs unless you are a CL developer.
This, and the current implementation can be replaced with something else in the future, e.g. if a CDR that standardizes some sort of describe hooks is created and adopted.
How does this sound?
Closes #13 Closes #14 Closes #16 Closes #20
I've come full fircle and reimplemented
lisp-namespace
in terms of In Nomine. The syntax and behavior should be fully backwards-compatible, other than for removingnamespace-let
andnslet
(which were unfinished anyway; maybe it could be possible to implement them in terms of defining binders formetabang-bind
, but it seems a bit unnecessary).A new README is also added.
There's a test suite for testing the default behavior of
define-namespace
andclear-namespace
- please review if the test suite looks OK with regard to testing the current behavior.The CI downloads In Nomine from git main branch and passes (except for the recent ABCL downloading failure, which requires a Roswell update).
Since I pretty much rewrote all the code, I volunteer to maintain both In Nomine and this library if this PR is merged.
While we're at it: should
lisp-namespace
be incompatibly changed by generating makunbound functions as well? I've noticed that the current version doesn't do that by default.