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
Question - reading material to learn writing macros? #61
Comments
Thanks for the question! You can start from doc/code_generation.pdf (just added): it contains the slides about code generation I presented last October at GoLab 2018 with an introduction to the topic. After reading that, I suggest experimenting with macros and quasiquoting at gomacro prompt to get a practical feeling of how it works. The gomacro command Then you should be able "use the source" i.e. to decipher actual code that uses them - for example the files For reference: macros and quasiquote are designed to be almost identical to Common Lisp macros and backquote/quasiquote - but Common Lisp material is very hard to read if you do not know the language. |
Ironically, at this point I know lisp better than go. Cheers for the pointers, I'll return when I find some time to dereference them |
Just to check, is it accurate to say: Definitions of things preceded by ':' happen at compile time. Macros are then applied to the code being compiled that hasn't been compile time lifted, but macro arguments must be provided as separate expressions with semicolons between, ala 'macroname; arg1; arg2;' ? (the quasiquoting stuff makes complete sense, it's everything else I'm slightly confused by) |
True, those parts are not explained. There is no syntax to invoke a macro: you use the syntax of the place where you insert the macro call. funname(arg1, arg2, macroname, arg3, arg4) or case expr1, macroname, expr2, expr3: etc. The prefix |
The readme doesn't seem to show me how the macro stuff works and I don't understand the codebase enough to just UTSL, but would like to know what to read to figure it out. Not expecting a trivial answer, just wanting suggestions as to where to start. Ideas?
The text was updated successfully, but these errors were encountered: