Reputation
15,885
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
Badges
1 39 63
Newest
 Good Answer
Impact
~216k people reached

Jul
2
comment Is A Language-Integrated Build System Generally Desirable?
What you describe is not a build system. It's just dependency resolution. Which can be left to the build system of course, but is not its primary function.
Jun
27
comment What problem do algebraic data types solve?
@usr Finding the catch-all clause is not what the compiler does (and in any case is a simple syntactic transformation as you describe). However, the compiler instead has to check if clause1 || clause2 || ... is a tautology, which is indeed equivalent to testing the satisfiability of !clause1 && !clause! && ... - but I'm still skeptical because this is a reduction from exhaustiveness to SAT, not the other way around (i.e., if we can solve SAT we can solve exhaustiveness, but no mention of the other way around).
Jun
27
comment What problem do algebraic data types solve?
@usr No language I'm aware of attempts a perfect solution, either the compiler understands that it's exhaustive or you're forced to add a catch-all case where you crash and burn. I don't know of a relation to SAT though, do you have a link to a reduction? Regardless, for actual code written in real programs, exhaustiveness checking is a drop in the bucket.
Jun
22
comment What problem do algebraic data types solve?
@Ian Most functional languages are statically typed and check exhaustiveness of pattern matching. However, if there is a "catch all" pattern, the compiler is happy even if the function would have to deal with the new case to do its job. In addition, you have to recompile all dependent code, you can't compile just one library and re-link it into an already-built application.
Jun
20
comment Are Constant Time and Amortized Constant Time effectively considered equivalent?
Does the assignment specify how random removals are performed? Are you given an index to remove or a reference to a queue element?
Jun
14
comment Compilation to bytecode vs machine code
@Julian "middle end" is a real term, coined in analogy with "front end" and "back end" with no regard for semantics :)
Jun
14
comment Compilation to bytecode vs machine code
Ignoring optimizations and such is silly. These "optional steps" make up a great deal of the code base, complexity, and compile time of most compilers.
Jun
12
comment Why do programs use call stacks, if nested function calls can be inlined?
@moonman239 Then your wording threw me off. Still, your question can be decomposed as I do in my answer and I think that's a useful perspective.
Jun
12
comment Why do programs use call stacks, if nested function calls can be inlined?
I am skeptical of that but regardless that's not what I claimed.
Jun
12
comment Why do programs use call stacks, if nested function calls can be inlined?
It's very debatable is CPS has no "call stack". It's not on the stack, the mystical region of ordinary RAM that has a little bit of hardware support through %esp etc., but it still keeps the equivalent bookkeeping on an aptly named spaghetti stack in another region of RAM. The return address, in particular, is essentially encoded in the continuation. And of course continuations are not faster (and it seems to me this is what OP was getting at) than making no calls at all via inlining.
Jun
12
comment Why do programs use call stacks, if nested function calls can be inlined?
@JacquesB Many optimization algorithms are quadratic, cubic, or even technically NP-complete. The canonical example is register allocation, which is NP-complete by analogy with graph coloring. (Usually compilers don't attempt an exact solution, but only a couple of very poor heuristics run in linear time.) Many simple, one-pass optimizations need superlinear analysis passes first, such as everything that depends on dominance in control flows (generally n log n time with n basic blocks).
Jun
4
comment Round amounts internationalized
Rounding is different from truncating. Maybe different rounding modes are of different popularity in different countries, but I've never heard of anyone who says "round" to mean "truncate" (which is what floor does, really).
Jun
3
comment Why don't Windows/Linux use relational Databases (RDBMS)?
@gnasher729 The file system is a very particular kind of database, and as such only good for particular kinds of data. Other kinds of data are better served with different kinds of databases (e.g. relational).
Jun
3
comment Why don't Windows/Linux use relational Databases (RDBMS)?
A file system is a database.
Jun
2
comment Unit Testing Competition
You don't seem to quite realize the full extent yet. Any measure of who wrote the best test cases will either be completely subjective or have these problems to some degree. What metric works best will depend on your goals for this competitions and on how mature (i.e., unlikely to exploit the scoring rather than writing the best tests they can) the contestants are.
Jun
2
comment What stops C from being compiled/interpreted/JIT'ed?
@MichaelT But LLVM as used by Clang and Dragonegg doesn't do any of those things. "LLVM" doesn't even stand for "Low Level Virtual Machine" any more, the acronym is a misnomer and discontinued. While we're talking about C, LLVM is just an intermediate representation with an optimizer and a machine code generator.
Jun
2
comment What stops C from being compiled/interpreted/JIT'ed?
@MichaelT LLVM has nothing to do with this question. LLVM IR is not portable.
May
24
comment How to design for good abstractions using algebraic data type?
Of course you can implement it as a sum type. The question is whether that's the best approach. (This is not simply a more interesting question, it's also the question OP asks.) Not making it a sum type but rather representing the different cases with distinct, though interrelated, types basically informs the type system of the state so errors like trying to change the headers of a response after the start of streaming can be prevented statically.
May
23
comment How to design for good abstractions using algebraic data type?
This theory here is too simplistic to be useful. There are disjoint cases (e.g., either the HTTP headers have been sent or not) that are useful to distinguish at the type level, as the hyper library mentioned in the question does.
May
15
comment What makes functional programming languages declarative as opposed to Imperative?
@ALXGTV Functional programming is a very different paradigm, even if you're adamant about reading it as imperative (it is a very broad classification, there is more to programming paradigms than that). And the other code that builds on this code may be read declaratively too: For example, map (sum_of_fac . read) (lines fileContent). Of course at some point I/O gets into play but as I said, it's a continuum. Parts of Haskell programs are more imperative, sure, just like C has a sorta-declarative expression syntax (x + y, not load x; load y; add;)