thephoeron / let-over-lambda

Doug Hoyte's "Production" version of macros from Let Over Lambda, ready for ASDF and Quicklisp.
Other
131 stars 25 forks source link

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

Closed equwal closed 1 year ago

equwal commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Cf., Pull-Request #17

equwal commented 5 years ago

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 commented 5 years ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

nice to see this thing move after only five years