News for hackers. Stuff that matters.
Re:Macropy: Syntactic Macros for Python by lihaoyi on Saturday May 16, 2020 @10:44AM (#23203774)
Author here, funny to see this up here again after so many years. Happy to answer questions
Re:Macropy: Syntactic Macros for Python by cjauvin on Saturday May 16, 2020 @10:56AM (#23203874)
I don't know much about macros and it revived my interest for this topic, thanks. I wonder if it could be used to embed SQL statements directly in Python code? (not sure it would be a good idea, but it would make for an interesting experiment maybe).
Re:Macropy: Syntactic Macros for Python by lihaoyi on Saturday May 16, 2020 @10:57AM (#23203891)
As implemented, we do not change the superficial python syntax. That has a number of advantages around compatibility, but it means embedding raw SQL outside string literals isn’t possible. We could do things like validating/transforming SQL strings at compile time, like what we do with string interpolators or pyxl strings