-
Notifications
You must be signed in to change notification settings - Fork 173
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/Extend Macro Documentation #453
Comments
I hadn't really thought about this at all, but you're absolutely right – of course we need such a document! While I hope that some of these idiosyncrasies you mention will be removed in the future, many things will of course stay the same and until they are fixed it's very good to have some docs on it, for sure. All in all – feel free to open a PR with a draft of this document and I'll make sure to chime in! |
I’m more than happy to help as well. Sadly blog posts are prone to aging and they get outdated fairly quickly, so an up-to-date-by-default document would be great! |
This document exists now! |
I think it'd be worthwhile to have a doc page dedicated to writing macros in Carp--there are some restrictions when it comes to writing macros that may not be immediately obvious to new users:
defndynamic
-- macros themselves cannot recur.the
is not supported (afaik).case
in the definition of another macro, it resulted in unexpectedunable to find symbol
errors on the argument passed tocase
. Then again, I may have made a tangential error that caused this and the actual use may not be problematic.expand
is a super useful function to be aware of when writing macros, but you have to do some digging to find out it exists. (as it turns out, it's documented in the docs for Dynamic. I wound up finding it through a search in the source. So this is a lesser point--but I do think giving it a bit more exposure would be a benefit).Since my observations are highly anecdotal, there may be some other explanations for the restrictions/behaviors I'm citing here, but I think a dedicated doc would help clarify macro definition and usage!
I'm happy to work on this, but I will probably need to call in reinforcements for elaboration on some points and a healthy dose of peer-editing.
Here are the existing available macro docs (that I'm aware of):
defndynamic
to implement recursion.I think pooling together some of the knowledge in each of these resources into a general Macros reference doc is a good first step.
The text was updated successfully, but these errors were encountered: