Reputation
372
Next privilege 500 Rep.
Access review queues
Badges
1 10
Newest
 Scholar
Impact
~101k people reached

1d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
This is the right answer, which is probably why it has the most upvotes.
2d
awarded  Scholar
2d
accepted Is a global context stack a code smell?
2d
comment Is a global context stack a code smell?
@ewan: The timestamp is simulation time. it has nothing to do with the clock. every time a property is written, the internal structure appends the new value and the simulation time to a list, which is graphed.
2d
comment Is a global context stack a code smell?
Thanks, I mentioned hidden dependencies, but it's nice to be reminded how you pay the price for hiding them.
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
It's like if someone said: Why is california warm in the winter. And you said "california has an average temperature of 80° in the winter. Do you not see how that doesn't answer the question even though it's related to the question?
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
No. You've just said what they do instead.
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
This is the question: "So, my question is this: why is x < y < z not commonly available in programming languages, with the expected semantics?"
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
@RobertHarvey that's another good answer to why… these are the things that should be in your answer. Read the question again, and then read your answer.
2d
comment Is a global context stack a code smell?
+1 this is a good point. I have some testing, and it was a bit gross with the global context setting.
2d
revised Is a global context stack a code smell?
added 4 characters in body
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
@MasonWheeler I think we agree. I was just highlighting that it's not hard to get the grammar right for this. It's just a matter of deciding in advance that you want it to work this way.
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
@MasonWheeler What I'm saying is that the language has to be designed for it to work. One part of that is getting the grammar right. (If the rules are written so that the comparisons are interchangeable with other operators, say, because they have the same precedence, then you won't get the right behaviour.) Another part of that is interpreting the AST as a conjunction, which C++ doesn't do. The main point of my answer is that it's a language designer's decision.
2d
asked Is a global context stack a code smell?
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
@MasonWheeler No, not necessarily. If the rules are written so that the comparisons are interchangeable with other operators (say, because they have the same precedence), then you won't get the right behaviour. The fact that Python is putting all of the comparisons on one level is what allows it to then treat the sequence as a conjunction.
2d
comment Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
This doesn't answer the question.
2d
answered Why do most mainstream languages not support “x < y < z” syntax for 3-way Boolean comparisons?
May
17
comment Why is 0 false?
@Giorgio: I corrected my construction per your comment in my last comment…
May
17
revised Why is 0 false?
added 1 characters in body
May
17
comment Why is 0 false?
Ah, sorry, I made a mistake. In the flipped field XNOR is identified with +. Good catch!