3 ms·
pls explain me difference between it and eval
by totechite 7y ago
pls explain me difference between it and eval
- wry_discontent 7y agoFrom what I gather reading the docs, this ties into Babel and that lets you define actual new syntax rather than just eval strings.
- justinmchase 7y agoIt lets you define syntax, which may be invalid in javascript, which then generates valid javascript at compile time.
- slaymaker1907 7y agoHygienic macros are aware of what they are using. For example, if your macro uses leftpad, calling code does not need to import or be aware of leftpad. Also, consider the issues around writing a swap macro using eval, how do you introduce a temporary which is guaranteed to not conflict with the caller’s code? Hygiene solves this by saying the macro’s temp variable is not the same as the calling code’s temp variable.