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

Add tutorial for macros #54

Open
gilch opened this issue Nov 25, 2020 · 2 comments
Open

Add tutorial for macros #54

gilch opened this issue Nov 25, 2020 · 2 comments
Labels
docs Explanation

Comments

@gilch
Copy link
Owner

gilch commented Nov 25, 2020

I could certainly walk through re-implementations of some of the basic macros. Should probably include nested templates, like defmacro/g/defmacro!. See if we can make the Lisp-2 macro work.

@gilch
Copy link
Owner Author

gilch commented Jan 6, 2021

The first lesson is up #78.

@gilch
Copy link
Owner Author

gilch commented Apr 10, 2022

There are still a number of TODOs in the macro tutorial source. Some of them seem outdated. The first two already cover a lot of ground, so additional lessons would have diminishing returns, but there are a few important techniques that still deserve mention. Some advanced macro techniques also applicable to Clojure or Common Lisp are perhaps already better covered elsewhere. Perhaps at most they deserve a link. However, some techniques are unique enough to Hissp (or Lissp) that they merit further tutorials.

In particular:

  • The use of Extras. Maybe not stable enough, and already covered in the quickstart. Unique to Lissp.
  • Metaprogramming the _macro_ object by implementing its __getattr__ (e.g. the Lisp-2 technique). Unique to Hissp.
  • Pre-expansion and code walking. The original plan was for a code-walking yield macro. I'm no longer certain if that is feasible, but we might be able to do better than Ensue. I limited Hissp to two special forms in part to make this kind of thing easier.
  • Destructuring fn. I put a lot of thought into lambda's parameters tuple to make this work better. This is pretty much unique to Hissp.

And easier lessons may be required to lead up to these.

@gilch gilch added the docs Explanation label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Explanation
Projects
None yet
Development

No branches or pull requests

1 participant