4 ms·
I actually think that tagged template strings in JS/TS could be a much better version of operator overloading! https://developer.mozilla.org/en-US/docs/Web/Java
by crubier 3y ago
I actually think that tagged template strings in JS/TS could be a much better version of operator overloading! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
This would give access to any math notation in a more flexible way, implementing a custom DSL in a type safe but expressive way.
Imagine writing stuff like
const result = math`${a} + ${b} / ${c}`
- crubier 3y agoI got nerdsniped and made a small library to test this concept. Might maintain https://github.com/crubier/opov https://github.com/crubier/opov