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

Backquote broken on SBCL again for defmacro/g! #16

Closed
equwal opened this issue Nov 18, 2018 · 9 comments
Closed

Backquote broken on SBCL again for defmacro/g! #16

equwal opened this issue Nov 18, 2018 · 9 comments

Comments

@equwal
Copy link

equwal commented Nov 18, 2018

defmacro/g! and friends don't work on SBCL 1.4.1 as far as I can tell.
I've implemented the functionality using a reader macro, and can probably do it for defmacro! also. Maybe that would be a better route than having to track SBCL's development. Let me know what you think about this.

@thephoeron
Copy link
Owner

Thanks for letting me know! I'll profile backquote expansion across recent versions of SBCL, and double-check the book for the intended semantics. In the mean time, I would be happy to hear more about the reader-macro strategy you have in mind.

@thephoeron
Copy link
Owner

Cf., Pull-Request #17

@equwal
Copy link
Author

equwal commented Nov 22, 2018

I wanted to be able to work with the code in the book, and the reader macros made it happen. If you find how to do another hack against the SBCL compiler, that might be better. The macros work like this: take something like (defmacro! mac (o!x) ...) and replace it with #d{mac (o!x)...}. So it is really just a drop in replacement. It isn't perfect yet, but it is better than not being able to use the code on SBCL at all.

@equwal
Copy link
Author

equwal commented Nov 27, 2018

once you get it working (warning, will complain!) try something like

#d{square (o!x) `(* ,g!x ,g!x)}
(setf *x* 3)
(square (incf *x*))

16
*x*->4

@Dwiib
Copy link

Dwiib commented Jul 22, 2023

Just chiming in since it seems like #17 is bust, I managed to get defmacro/g! working by using the named read table from fare-quasiquote-extras as suggested by https://www.reddit.com/r/lisp/comments/11917mf/comment/j9k8yg1

@thephoeron
Copy link
Owner

Just chiming in since it seems like #17 is bust, I managed to get defmacro/g! working by using the named read table from fare-quasiquote-extras as suggested by https://www.reddit.com/r/lisp/comments/11917mf/comment/j9k8yg1

Good to know, I'll check that thread out and see what can be done.

This may help with some of my other libraries as well.

@thephoeron
Copy link
Owner

Been playing around with FARE-QUASIQUOTE in some of my other libraries, with the kinds of macros SBCL hates the most, and it's working exactly the way I need it to.

I'm going to go ahead and integrate it here as well, with updated instructions on using NAMED-READTABLES conditionally for SBCL in user-code wherever LOL macros are called to ensure everything macroexpands correctly.

It can be a minor pain for larger libraries to manually specify a named readtable for every file, but I don't have ASDF's compile-around hook working quite right using symbol-call in ASDF operations for specialized subclasses of file-type components. I'll figure it out eventually. 🙃

thephoeron added a commit that referenced this issue Aug 2, 2023
…ble; increment semantic version to 1.1.0 for new feature. Should solve Issue #16
@thephoeron
Copy link
Owner

Just chiming in since it seems like #17 is bust, I managed to get defmacro/g! working by using the named read table from fare-quasiquote-extras as suggested by https://www.reddit.com/r/lisp/comments/11917mf/comment/j9k8yg1

Want to give the latest a try? the :LOL-SYNTAX readtable now includes :FARE-QUASIQUOTE.

I should also now be able to strip away the special handling of FLATTEN and other SBCL-specific issues. 🤘🏻

@equwal
Copy link
Author

equwal commented Aug 4, 2023

nice to see this thing move after only five years

@equwal equwal closed this as completed Aug 4, 2023
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

3 participants