It's an amazing idea, Jon. I find the second option more readable. Or, at least, it feels "righter". But I'm not sure it could work since a function cannot be used as a key in a plain object.
Anyway, I'd like to work on it, together. Would you like to?
Still trying to think of a way to make the second syntax work without unsafe monkey patching. I'm not sure it's possible. My POC uses the a[to](b) syntax. Basically, to is a method on the number prototype... nothing particularly fancy going on
Could even expand it to:
etc.
It's an amazing idea, Jon. I find the second option more readable. Or, at least, it feels "righter". But I'm not sure it could work since a function cannot be used as a key in a plain object.
Anyway, I'd like to work on it, together. Would you like to?
I already did a POC in about 5 lines of code - works perfectly
Still trying to think of a way to make the second syntax work without unsafe monkey patching. I'm not sure it's possible. My POC uses the
a[to](b)
syntax. Basically,to
is a method on the number prototype... nothing particularly fancy going onI think there is a way to do the 2nd syntax... I'll get back to you
It works 👍 And it's safe
I'm glad to read it. If you like to share I'd love to see it!