Skip to content

Comment on The WHY of WAT - understanding why 'JavaScript is Crazy'parent

Comments

No, it doesn't. If it's a string, it's a string: "1" + "1" -> "11". I know what you mean (it would if the first op wasn't a string), but see how this got confusing even in your short message. I'm still not sure why would you want to automate all types into a magic one that does what you want... unless you split all operators into N distinct ones giving you different results. But then you get the same result really - ops determine your results.

Again using phones example:

country + area + ending

is different depending on what the actual types are. This is simply an issue we cannot ignore. In this case I'm expecting the concatenation and the result cannot depend on "contents of the string".

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.