Reputation
12,548
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
2 37 82
Newest
 Nice Answer
Impact
~266k people reached

Jul
26
awarded  Nice Answer
Jul
21
comment How to handle mismatched request body and content-type header?
@ej_dutch: It depends on the circumstances. I would try to err on the side of providing good error messages, since it makes an API much nicer to use. In this case it’s pretty simple—“You submitted a JSON request with invalid JSON”.
Jul
21
answered How to handle mismatched request body and content-type header?
Jul
19
comment What is the meaning of “doesn't compose”?
Hah, of course not. Just an alternate phrasing. I have the sense that associativity is required to maintain the “flat” feeling of composition, but no strong argument to back that up.
Jul
19
comment What is the meaning of “doesn't compose”?
In other words, “doesn’t compose” means “doesn’t form a semigroup” (or, slightly more strongly, a monoid).
Jul
11
awarded  Nice Answer
May
11
comment Structuring Procedural vs OO code
OP asked about using C++ to write procedural code. I’ve removed the example because it has been misunderstood too much.
May
11
revised Structuring Procedural vs OO code
Removed example.
Apr
29
comment Structuring Procedural vs OO code
@Dunk: Datatypes with member functions are dual to functions with closures. You interpret “pass this function and this value” as “pass this object”. You could also interpret it as “pass this activation”. They’re identical in this case, with only 1 function in the vtable or 1 value in the closure. In OOP you can’t change the vtable because the object decides its own behaviour, while in FP you can’t change the closure because the function is a black box. But in procedural programming, data and behaviours are not generally coupled at all, which I was trying to illustrate.
Apr
29
comment Structuring Procedural vs OO code
@Dunk: I did exactly the opposite, per the original question. If you think that avoiding objects, member functions, and virtual dispatch still constitutes using a language in an OO way, then I cannot hope to convince you of anything.
Apr
29
answered Structuring Procedural vs OO code
Mar
23
comment Is higher-rank parametric polymorphism useful?
@GregRos: It’s also handy with existentials. In Haxl, we had an existential like data Fetch d = forall a. Fetch (d a) (MVar a), which is a pair of a request to a data source d and a slot in which to store the result. The result and slot must have matching types, but that type is hidden, so you can have a heterogeneous list of requests to the same data source. Now you can use higher-rank polymorphism to write a function that fetches all requests, given a function that fetches one: fetch :: (forall a. d a -> IO a) -> [Fetch d] -> IO ().
Mar
23
answered Is higher-rank parametric polymorphism useful?
Mar
7
answered Confusion regarding def function within Python
Feb
27
awarded  Disciplined
Feb
12
comment When would dynamic scoping be useful?
@JerryCoffin: Notable exceptions include Perl and Emacs Lisp—both used dynamic scoping originally, and now (Perl 5, Emacs 24) have support for both dynamic and lexical scoping. It’s nice to be able to choose.
Feb
5
comment What's the tradeoff for type inference?
It’s worthwhile to draw a distinction between type deduction (monodirectional, like C# var and C++ auto) and type inference (bidirectional, like Haskell let). In the former case, the type of a name may be inferred from its initialiser only—its uses must follow the type of the name. In the latter case, the type of a name may be inferred from its uses also—which is useful in that you can write simply [] for an empty sequence, regardless of the element type, or newEmptyMVar for a new null mutable reference, regardless of the referent type.
Feb
2
awarded  Popular Question
Jan
4
awarded  Guru
Jan
4
awarded  Enlightened