3 ms·
This guy is incredibly sanctimonious, but he misses the biggest problem with his notation. Not all the operators he uses are associative. const secret = msg
by powera 9y ago
This guy is incredibly sanctimonious, but he misses the biggest problem with his notation. Not all the operators he uses are associative.
const secret = msg => () => msg;
This technically parses uniquely, but it's not at all obvious what the parse structure is. Writing it with the squiggly brackets makes it clearly parsable.
const secret = { msg => { () => msg } };
- ericelliott 9y agoI'm not sure what you're trying to express. The "squiggly brackets" example is not valid JavaScript. If you need to disambiguate associativity, you need to wrap with parentheses: const secret = msg => ( () => msg ); But in this case, it's not required, because the alternative doesn't make sense: const secret = (msg => ()) => msg; ^ Unexpected token