14,270 reputation
13459
bio website
location
age
visits member for 4 years, 5 months
seen 2 hours ago

Feb
11
comment How should I unit test mathematical formulae?
I don't see how the first approach (test some reasonable values, add new ones as failures are exposed by other means) defeats the point of having a unit test. Many unit tests are regression tests. Turning real bug reports into test cases is a valid, useful and widespread method of creating regression tests. I don't really see all that much potential for that though, if the implementation is really just straightforward transliteration of a formula that already does what you want. In which case a few manually-picked values (try to choose edge cases) makes a perfectly fine unit test.
Feb
11
awarded  Nice Answer
Feb
11
comment Bridging the gap between abstract machines and computer achitectures?
@Tim I'd guess that course just takes Turing machines as a starting point to introduce the concept of an abstract machine, then quickly moves on to more useful abstract machines.
Feb
11
comment Bridging the gap between abstract machines and computer achitectures?
@amon It appears you've already written most of an answer, why let it "go to waste" in a comment?
Feb
11
revised Bridging the gap between abstract machines and computer achitectures?
added 22 characters in body
Feb
11
answered Bridging the gap between abstract machines and computer achitectures?
Feb
8
comment Is a programming language a set of programs or a set of instructions?
@FredOverflow From the context, that is a typo and should read "[...] catch at compile time".
Feb
8
answered Is a programming language a set of programs or a set of instructions?
Feb
8
comment Is it not direct usage of primitive pointer types form of Primitive Obsession?
What disadvantages does the pointer have, or rather, what problems would a CItemHandle class solve? Using a bare string for a human name is bad because, among other things, the type is non-descriptive, it may allow meaningless operations, and it can facilitate semantic confusions. Not because some deity proclaimed that Thou Shalt Not Use Primitives.
Feb
8
comment When, if ever, are basic concurrency optimizations generally made?
Who are you talking to? That's completely, utterly wrong in all remotely mainstream languages. So wrong, in fact, that I can't help but wonder whether you misunderstood those people.
Feb
4
comment What limitations does the JVM impose on tail-call optimization
@supercat I'm not sure where we're disagreeing, or whether we're even disagreeing at all, so I'll call it a day here.
Feb
4
comment What limitations does the JVM impose on tail-call optimization
@supercat "May" in that it does not make a difference for a lot of code (that which doesn't inspect the stack and does any of the other things that can detect tail calls). Of course the point of enabling tail calls is having them guaranteed.
Feb
4
comment What limitations does the JVM impose on tail-call optimization
@supercat D'oh! That neatly dismantles Jörg's objection for the general case. Have the programmer opt into a tail call, accepting that it may alter semantics.
Feb
4
comment What limitations does the JVM impose on tail-call optimization
@JörgWMittag You make a good point, a JVM can easily detect the pattern call something; oreturn. The primary job of a JVM spec update would be not to introduce an explicit tail-call instruction but to mandate that such an instruction is optimized. Such an instruction only makes compiler writers' jobs easier: The JVM author doesn't have to make sure to recognize that instruction sequence before it gets mangled beyond recognition, and the X->bytecode compiler can rest assured that their bytecode is either invalid or actually optimized, never correct-but-stack-overflowing.
Feb
3
comment Can we write algorithms without conditional statements?
I'm voting to close this question as off-topic because it belongs to Computer Science, and has in fact already been posted there.
Feb
3
comment Can we write algorithms without conditional statements?
Again? Didn't you ask this question twice already? What's wrong with the existing answers?
Feb
2
comment How is atomicity of reference operations enforced?
I have doubts regarding the impossibility of "atomic" 64 bit writes. One doesn't need all the guarantees of an atomic operation (such as the memory fence or the visibility to other threads). You just need to make sure that, if the two 32 bit halves are spread over two cache lines, both are moved to modified state (assuming MESI) before one half is written and requested by another thread. I would not be surprised if ordinary non-atomic movq already does that. Remember, you can't have 64 bit references on IA-32.
Feb
2
comment How is atomicity of reference operations enforced?
Oh, you're using "atomic" in the sense of "it can't ever happen that only half of the data was written". Usually atomicity refers to more than just that.
Feb
2
comment How is atomicity of reference operations enforced?
Which operations, and which languages? I can't think of a single language that guarantees atomicity for any operation on references (or other data) unless one explicitly opts in with an AtomicReference type or something like that.
Jan
30
comment Why can we use the same name for local variable in different scopes?
Removed my downvote, but I think explaining it with implementation details (call stack and frame offsets) is not very helpful.