3 ms·
> So the compiler itself just sees the `a = b`, the `b => a` is never visible, therefore precedence isn't germane to the template itself. Not quite. Imagine y
by moonchild 6y ago
> So the compiler itself just sees the `a = b`, the `b => a` is never visible, therefore precedence isn't germane to the template itself.
Not quite. Imagine you have:
3 + b => a
Is that 3 + a = b, or a = 3 + b? Precedence still comes into it. (I don't know nim's solution.)
- samatman 6y agoHmm no I'm pretty sure in a template it's, ok I'm going to use different variable names for clarity: 3 + c => d the left hand side (3 + c) is b, and the right hand side is (d) is a, and this will apply no matter what you put on those sides, so it's rewritten in its entirety before the actual compiler sees the code. Unless you're talking about a scope violation/dirty macro situation? And yeah I don't know Nim's story around hygiene either, but: it's usually only a problem with Lisp macros, exactly because of the homoiconicity. I'd wager Nim templates have their own scope that won't shadow the rewrite.