3 ms·
We have like 5 different `with` macros including one in stdlib.
by planetis 6y ago
We have like 5 different `with` macros including one in stdlib.
- mhh__ 6y agoI assume "We"=Nim? It's an interesting pattern to test language designs with. On the one hand expressive macros can be disastrous in big codebases, on the other hand a more "monadic" (implemented via passing some kind of object through a chain rather than algebraically) way is very template-intensive.
- cb321 6y agoAt least one (very bottom of [1]) of the 5+ variants makes you list which fields the code gets access to (in a tiny 6 line Nim macro). That is an alternate, perhaps more keystroke-heavy solution to the problem bothering @simias. [1] https://github.com/c-blake/cligen/blob/master/cligen/macUt.nim https://github.com/c-blake/cligen/blob/master/cligen/macUt.n...