3,083 reputation
1322
bio website blueraja.com/blog
location
age
visits member for 3 years, 11 months
seen 14 hours ago

2d
comment Are all magic numbers created the same?
if 3.50 is used in only one place, I would define it as a constant on the line above.
Jul
29
comment Should the commit history be used to convey critical information to developers?
-1 emails don't work well as documentation
Jul
9
comment What does it mean for a sorting algorithm to be “stable”?
"Stable" can also apply to data-structures, eg. a "stable heap" is a heap which dequeues items that have the same priority in the same order they were queued. This is very important for efficient path-finding algorithms.
Apr
30
comment What's wrong with circular references?
I wasn't claiming it's a good practice, I was just pointing out it's not impossible as claimed in the answer.
Apr
29
comment What's wrong with circular references?
Dependency injection is not impossible with circular references, even with automatic DI. One will just have to be injected with a property rather than as a constructor parameter.
Jan
20
awarded  Yearling
Dec
30
answered Implementation of algorithm to generate chess positions
Dec
30
comment Implementation of algorithm to generate chess positions
Each bishop attacks up to 14 different squares, so this is actually about 444k positions to search (15862*28). We can do significantly better than that - see my answer.
Dec
22
awarded  Good Answer
Dec
22
awarded  Announcer
Nov
21
comment Why do most programming languages only support returning a single value from a function?
@David I'm not sure what you mean by the "current convention," all calling conventions use the stack. thiscall (the calling convention used by C++) uses one register for the this pointer, and the rarely-used fastcall stores the first two arguments in registers. Everything is is on the stack. See also
Nov
21
comment Why do most programming languages only support returning a single value from a function?
@David no, cdecl allows for (theoretically) unlimited number of parameters (that is why varargs functions are possible). Though some C-compilers may limit you to several dozen or hundred arguments per function, which I think is still more than reasonable -_-
Nov
14
comment Is there any “real” reason multiple inheritance is hated?
"a well done system of trait style composition would be really powerful/useful..." - These are known as mixins, and they are powerful/useful. Mixins can be implemented using MI, but Multiple Inheritance is not required for mixins. Some languages support mixins inherently, without MI.
Oct
30
comment Why can't Java/C# implement RAII?
duplicate of Did the developers of Java consciously abandon RAII?, though the accepted answer is completely incorrect. The short answer is that Java uses reference (heap) semantics rather than value (stack) semantics, so deterministic finalization is not very useful/possible. C# does have value-semantics (struct), but they are typically avoided except in very special cases. See also.
Oct
29
comment Is linq more efficient than it appears on the surface?
See also Why are Where and Select outperforming just Select?
Oct
26
awarded  Guru
Oct
25
comment What are the safety benefits of a type system?
@BenjaminGruenbaum: ...What!? It is obviously not undecidable in statically-typed languages, or else writing a compiler for those languages would be impossible.
Oct
25
comment What are the safety benefits of a type system?
@BenjaminGruenbaum: A "clever linter" can only detect type errors before runtime in the most trivial of cases. In general, the problem is undecidable in non-statically-typed languages like Javascript.
Oct
21
awarded  Good Answer
Oct
18
awarded  Nice Answer