Skip to content
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

local's def vs. defvar #43

Open
Ambrevar opened this issue Oct 7, 2019 · 3 comments
Open

local's def vs. defvar #43

Ambrevar opened this issue Oct 7, 2019 · 3 comments

Comments

@Ambrevar
Copy link

Ambrevar commented Oct 7, 2019

The local macro supports defun, etc. but surprisingly it does not support defvar. Instead, the user must use def.

I wonder why that is. Wouldn't that trip the user? Why not supporting defvar for consistency?

@ruricolist
Copy link
Owner

I wanted to have defvar, but the semantics of a global defvar can't be fully imitated by a local binding. You can make a symbol locally special (using (declare (special ...)), but that binding is only visible in the dynamic environment of called functions if they opt in with a special declaration of their own.

Note that def is supported globally, so it is (at least) consistent.

@Ambrevar
Copy link
Author

Ambrevar commented Oct 8, 2019 via email

@ruricolist
Copy link
Owner

Same problem, alas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants