4 ms·
The game shows us how ugly JS is.
by dou4cc 10y ago
The game shows us how ugly JS is.
- tomelders 10y agoSwift. The Javascript of tomorrow, today!
- k_bx 10y agoPureScript. The Swift of today. Yesterday, today and tomorrow!
- tomelders 10y agoBut it compiles to ES5. At this rate, we'll be deploying ES5 for the rest of human history while we all pretend we're writing ES451. And it's whitespace significant, which is something only maniacs like in a programming language. I'm half joking, don't get too offended... But whitespace significance is madness.
- posterboy 10y agoIndeed, I refuse to believe there should be a solution to the 'reflexive' task.
- teraflop 10y agoThat one isn't specific to Javascript, though. If you can find a mainstream language that doesn't have any values that aren't equal to themselves, I'll give you a cookie. (Going from memory of the last time I tried this challenge, since I can't get it to load at the moment.)
- posterboy 10y agoThe important property of evaluation is determinism defined by the equality of the output. Classically, id(x) != id(x) is logically inconsistent. Boolean Logic and natural languages are pretty mainstream in my opinion. Do you mean programming languages? If IEEE whatsthenumber is implemented in the FPUs to provide fcmp (Floating-point Compare Instruction), the languages don't have much of a choice. When there are different types of equality, ie. compare instructions, you have no equality. That's maybe a bit binary. I'm sorry, I thought this was Computer Science.
- Etzos 10y agoYou seem to be splitting hairs and I'm not entirely sure why. Following the flow of conversation it should be pretty easy to infer the parent was referring to programming languages. Originally you said you don't think there should be a solution to the reflexive problem, and that in reply to a comment mentioning that Javascript was ugly (which is where the context of _programming_ language came from). I, and I believe the parent as well, took that to mean that you consider Javascript ugly because you don't believe it should operate the way it does. However, the point the parent was trying to make is that this is something common to all (programming) languages which follow the IEEE 754 standard and is therefore not some special case which makes Javascript any more ugly than another (programming) language. It may not seem obvious and it may seem logically inconsistent but, like you said, this is computer science and things don't always work exactly the way we think they should. Usually because the obvious logical solution has problems when implemented so we change things around. In this case, NaN != NaN because of some of the limitations at the time IEEE 754 was proposed.
- posterboy 10y agoNo, of course that was news to me. But I am not advocating any programming language. This looks like a wart, but a compelling one to commit to, because it's a simple solution. > It may not seem obvious and it may seem logically inconsistent but, ... An if an argument is made in defense of inconsistent logic, how could the argument be expected to be logically consistent? Your argument by authority is not very good. There are involved explanations on stackoverflow.com, but I didn't bother to read, yet. Another solution would be to set the carry flag.
- lake99 10y ago> Classically, id(x) != id(x) is logically inconsistent. Equality is domain dependent. For example ∞!=∞ could be justified, as can (0/0)!=(0/0). In the domain of real numbers, equality can be an undecideable problem[1]. I guess the designers of these languages had to choose between tolerable defaults or throwing exceptions. I'm happy with JS doing this: % node > 1.0/-0 -Infinity > 1.0/0 Infinity > 0/0 NaN > 0/NaN NaN > 1+NaN NaN [1] https://math.stackexchange.com/questions/143727/determining-the-equality-of-two-real-numbers https://math.stackexchange.com/questions/143727/determining-...
- deleted 10y ago[deleted]
- XaspR8d 10y agoSo you disagree with the IEEE floating point specification, then? Javascript is directly following spec there.