Reputation
60,424
Next tag badge:
139/100 score
17/20 answers
Badges
13 179 261
Newest
 Good Answer
Impact
~2.1m people reached

Jan
28
comment in dynamic language like javascript how do you know what the argument is?
Meh. If something is a final class with no public constructors, you won't have much searching to do; the answer to how to instantiate it will obviously be on a static method within the class itself. The one you want will almost certainly have a return value of type Configuration. (And if not it will have a ref/out parameter of that type, or accept a list or other collection to put the new value in, but those are weird, uncommon cases; usually it'll be the return value.) Having declared types helps you easily narrow it down like that.
Jan
25
comment Should we avoid language features that C++ has but Java doesn't to increase maintainability?
"If you want code that's easy to understand and parse, go with LISP or whatever." I wouldn't agree with that. Lisp is trivial to parse, but precisely because of this--because it was created in a time when the knowledge of parsers and the principles behind building them effectively was still in its infancy, and so they punted and went with the most ridiculously simplistic thing that could possibly work--you don't get a lot of the syntactic benefits of modern languages. So it's easy to parse, but not at all easy to understand. There's a reason people call it "Lost In Superfluous Parentheses."
Jan
25
comment in dynamic language like javascript how do you know what the argument is?
You don't. That's the problem.
Jan
24
revised Trying to understand P vs NP vs NP Complete vs NP Hard
deleted 9 characters in body
Jan
23
comment Why does integer division result in an integer?
@JerryCoffin Yes, it should be obvious, from my comments elsewhere in this question, that I'm quite aware of div and what it does.
Jan
22
awarded  Nice Question
Jan
21
comment Why does integer division result in an integer?
@ZdeněkJelínek Fixed-point arithmetic is, by definition, neither floating-point nor integer arithmetic, so why are you bringing it into this discussion?
Jan
21
comment Why does integer division result in an integer?
@LightnessRacesinOrbit: And how is forcing you into "integer division," which also doesn't abide by the rules of arithmetic, is less problematic or ludicrous? The correct way to do it is to recognize that integer division is not actually division, and have a distinct operator for it. (ie. the way Pascal and Python both do it.)
Jan
21
comment Why does integer division result in an integer?
So FP division produces larger errors the bigger the difference between the divisor and dividend, and integer division produces larger errors the smaller the difference between the divisor and dividend. Why, then, is integer division preferable, when most real-world use cases involve divisors and dividends that are relatively close to each other?
Jan
21
comment Why does integer division result in an integer?
@DeerHunter Mathematically, you want the result of an operation to be mathematically correct
Jan
21
comment Why does integer division result in an integer?
@soandos I can't recall ever once running across a real-world use case comparable to that question that does not also involve calculating, at the same time, "how many people will be left over that I can't put on a team of three?" (In other words, also using the modulus operation, as I said.)
Jan
21
comment Why does integer division result in an integer?
@soandos In Python, // is the integer-division operator and # is a single-line comment. In Pascal, the integer-division operator is the keyword div. Both work quite well for their respective languages. C does probably the worst thing possible: one operator that can do two completely different things based on arbitrary context.
Jan
21
comment Why does integer division result in an integer?
@soandos Yes it is, if you understand basic, grade school-level arithmetic. What's not obvious at all is the made-up concept of "integer division". When's the last time you had any use for it that didn't involve also using the modulus operation?
Jan
21
comment Why does integer division result in an integer?
@Snowman I would hardly call something defined in a way that the obvious, intuitive interpretation is not correct "well-defined".
Jan
21
comment Why does integer division result in an integer?
@Snowman It's broken behavior because it's incorrect. 3/2 = 1.5, not 1. It's an obsolete limitation of ancient hardware because modern CPUs have built-in fast support for FP math as a standard feature, and have since the 1990s.
Jan
21
comment Why does integer division result in an integer?
@soandos: The way Pascal and Python both do it: have a distinct integer-division operator, but the standard division operator always returns the mathematically correct result. (Or--for the pedantic--as correct as you can get given the limitations of FP math.)
Jan
21
answered Why does integer division result in an integer?
Jan
20
comment Composition over inheritance but
@DavidArno OK, whatever. Go ahead and believe that, while the rest of us go on being more productive than you. ;)
Jan
20
comment Composition over inheritance but
@DavidArno That's just plain ridiculous. Inheritance is one of the most useful, productive features ever developed in the entire history of programming. As with anything useful, there are plenty of ways to abuse it, but used properly it massively increases the power and productivity of your work.
Jan
16
answered C# / VB.NET build expression trees only from lambda expressions — why?