11,805 reputation
12852
bio website
location
age
visits member for 4 years, 1 month
seen 13 mins ago

Oct
14
awarded  Nice Answer
Oct
13
answered Illegal in PHP: Is there an OOP design reason?
Oct
10
comment What drawbacks are there to condition-based scope?
@KarlBielefeldt I might, after seeing OP's reaction to judge the level at which the question resides, and whether OP can come up with any additional details.
Oct
10
comment What drawbacks are there to condition-based scope?
I accidentally a word in the comment above: "it's often infeasible -- sometimes literally impossible". tl;dr PLT is hard.
Oct
10
comment What drawbacks are there to condition-based scope?
It's not even clear to me how to formalize this properly, in particular the "same condition" bit. You can't just check if the condition is syntactically the same, since it might evaluate differently the second time (consider anything non-deterministic, or anything dependent on mutable state altered in rest of initialization). Even if you restrict it to bare variables as in your example, if they're not local (the one in your example isn't) it's often -- sometimes literally impossible -- to computationally check that it isn't changed between the two conditions.
Oct
8
comment Is hash calculated before/after compression?
Yes, strike that. I figured out what was really bugging me: Many checksums are calculated over arbitrary payload which may very well be compressed (e.g., TCP, many network protocols building on TCP, torrents, Ethernet frames, IPv4). To checksum the uncompressed data, the part doing the checksum has to know about the compression taking place.
Oct
8
comment Does C++ abuse the stack?
If anything, C++ makes stack allocation less necessary (or rather, free store allocation easier) because RAII and standard classes utilizing RAII make it far easier to delete correctly.
Oct
8
comment Why is reading from memory not a side-effect but reading from a file is?
@gnat I/O is a side effect, period. It's one of the classic examples. We're not Wikipedia, we don't need citations for folk knowledge. If you think something can be improved about the question, say it outright rather than going through this straw man.
Oct
7
comment Do objects with validation logic in their domain really represent their real world counterparts?
The purpose of programs is to transform data (in this case, key press events into either an error message or a database entry). Models of the real world can be useful, but one can over-extend them.
Oct
4
comment When does it make sense to compile my own language to C code first?
@Panzercrisis Most JIT compilers require their machine code backends to support things like replacing a function and patching existing code with a jump/trap door. Aside from that, gcc specifically is... architecturally less suited to JIT compilation and other use cases. Check out libgccjit though: gcc.gnu.org/ml/gcc-patches/2013-10/msg00228.html and gcc.gnu.org/wiki/JIT
Oct
2
comment When does it make sense to compile my own language to C code first?
@emodendroket However, C# and Java compile to an IL that is designed to be an IL in general and for C#/Java specifically, so in many ways CIL and JVM bytecode are more sensible and convenient as an IL than C could ever be. It's not about whether to use any intermediate language, it's about which intermediate language to use.
Oct
1
comment Is it acceptable to ask management for pseudo code?
@FastTrack Well, if you think so, but I've yet to see pseudo code that is actually close enough to a sensible architecture to help with that. Like, maybe your superior can give you a rough procedural outline for calculating the price of a product, but in your product that calculation has to happen in the database too and for organizational reasons it has to be spread across ten methods and the pseudo code glosses over how to fetch some piece of data and the real code has to deal with a database and handle exceptions and oh my and see where I'm going? ;-)
Oct
1
comment Is it acceptable to ask management for pseudo code?
Unless management consists of good programmers promoted to management, and puts serious effort into it, any pseudo code they'll write will be as informal and high-level as the spec you have. And even then, pseudo code leaves a lot of room for ambiguity since it's usually just plain English with idiosyncratic formatting. If the problem is that you can't comprehend the spec as given, then transcribing the spec into a different format won't fix that problem.
Oct
1
comment Which programming language first came up with the finally block?
@ratchetfreak It's not that simple. ... is also executed when the try block is left via any other means: continue, break, return, and whatever other control flow statements the language offers. Of course there is still a way to replace the finally with other constructs but I think it's far beyond the threshold for syntactic sugar.
Oct
1
comment Why implement a lexer as a 2d array and a giant switch?
How would you implement the transitions of the DFA states? And what's this about terminals and non-terminals, "non-terminals" usually refers to production rules in the grammar, which would come after lexical analysis.
Oct
1
comment Is there a way to prevent variables from changing their type in Python?
Do you want a yes/no answer or are you open to being sold on why this isn't a terrible thing(tm)?
Sep
30
comment Why are for loops needed?
I don't buy the compiler optimization angle. Clang, for example, lowers all kinds of loops as well as the equivalent conditional gotos into exactly the same IR (which is in CFG form and only has conditional and unconditional jumps between basic blocks) early in the optimization process. It doesn't seem to hurt the performance of the generated code at all.
Sep
29
awarded  Nice Answer
Sep
29
awarded  programming-languages
Sep
28
comment How do web servers deal with issues that arise when a machine has been on for a long time?
But is that a realistic approach? In other words, is server software never faulty, and how is this ensured?