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

eval-when-compile permits compile-time definitions that can be used from macros #187

Merged
merged 5 commits into from
Jun 19, 2013
Merged

eval-when-compile permits compile-time definitions that can be used from macros #187

merged 5 commits into from
Jun 19, 2013

Conversation

khinsen
Copy link
Member

@khinsen khinsen commented Jun 2, 2013

Fixes #186

@paultag
Copy link
Member

paultag commented Jun 2, 2013

Clever. Very clever. You mentioned this has a precedent, @khinsen? Mind linking me to the docs for some of it (actually just interested, I'll likely merge this after a quick @jd / @olasd signoff that we're not doing something that breaks internals)

@olasd
Copy link
Member

olasd commented Jun 2, 2013

Looks good to me from an internals POV. The hy_eval dance could be factored out in a common function.

From a semantics POV, the eval-when-compiled thing is evaluated at runtime too. Is that intended? (I feel it contradicts the meaning of the eval-when-compile special form in elisp, for instance). Either way, it should be tested.

@khinsen
Copy link
Member Author

khinsen commented Jun 2, 2013

I actually stole both the name and the semantics from elisp. I agree that the name suggests that the evaluation is limited to compile time.

I don't see a point in evaluating something only at compile time but not at runtime, so I'd like to keep the semantics of the current version, but I am open to suggestions for a clearer name.

@olasd
Copy link
Member

olasd commented Jun 2, 2013

http://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Compile.html suggests the opposite. The semantics you are talking about seem to be from eval-and-compile? I think we need some @jd knowledge here :)

@khinsen
Copy link
Member Author

khinsen commented Jun 3, 2013

Oops, you are right, it's eval-and-compile that I tried to imitate. And now I am hesitation about whay I want, because in elisp it's eval-when-compile that is used much more frequently.

Looking at my own use cases, all I need is eval-when-compile but it never does any harm to use eval-and-compile instead. I can easily construct use cases that require one or the other, but they are made up. My real-life Lisp experience is mostly Clojure, which doesn't have the distinction between compile and load/eval time.

@paultag
Copy link
Member

paultag commented Jun 8, 2013

This seems like thrilling stuff; can I get a @jd comment on this?

@paultag paultag merged commit 2674016 into hylang:master Jun 19, 2013
@paultag
Copy link
Member

paultag commented Jun 19, 2013

Throw caution to the wind! Thanks, @khinsen !

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

Successfully merging this pull request may close these issues.

Macros can't use previous definitions from the same module
3 participants