-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nil
vs ()
#8
Comments
Indeed, this is handled by |
I'm much afraid that I propose to tag wontfix for now and try to workaround this bug. |
Sounds good. In fact, I'd say we can close this. Here's a small function that will do the trick: (defun prin1-to-sexp (val)
"Convert VAL to a sexp.
Crucially, renders nil as (), not nil."
(if (listp val)
(concat "(" (mapconcat #'prin1-to-sexp val " ") ")")
(prin1-to-string val))) It breaks if passed an improper list (such as |
Cool, thanks, even if it's a pity to have this minor difference. Note that this could still be fixed in the future by rolling out our own parser once the whole thing is more stable, so feel free to reopen if needed. For reference, here are
the last one is interesting as it will determine the escaping done by sertop's printing. I'm not opposed to rolling our own versions if we have good reasons. |
In the "issues with serializing to sexps" family, I've just run into the following problem: many lisps do not distinguish between
'()
andnil
, and thus serialize()
tonil
.For example in common lisp:
And in Emacs Lisp:
Could we add an option to SerAPI to accept
nil
as a synonym for()
? Currently I get this:In the meantime, I'll look at whether I can make the Emacs lisp printer produce '().Looking at Emacs' source code, there doesn't seem to be a way to make it print
()
instead ofnil
, but it's pretty easy to write a decent workaround, so I'd call this low priority.The text was updated successfully, but these errors were encountered: