zlacker

[parent] [thread] 1 comments
1. crubie+(OP)[view] [source] 2023-05-20 04:48:52
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/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}`

replies(1): >>crubie+bd
2. crubie+bd[view] [source] 2023-05-20 08:27:33
>>crubie+(OP)
I got nerdsniped and made a small library to test this concept. Might maintain

https://github.com/crubier/opov

[go to top]