Hacker News new | past | comments | ask | show | jobs | submit login

I think he's getting at the distinction between operational and denotational semantics. Presumably, operational semantics are a better fit for systems programming, because if you need to imagine what the computer is actually doing (Linus's comments about why he likes C comes to mind). Ocaml is more in a denotational direction than C - although to be honest, I don't ultimately understand the distinction, given that C relates to an abstract machine that is not all that similar to most machines today.



But monads are a version of small-stem semantics. And the write linker, so something that operates low-level data, not an actual low-level code, OCaml is a great language for that.

Take a look at BAP, it heavily uses OCaml features and implements a beautiful design:

https://github.com/BinaryAnalysisPlatform/bap

https://binaryanalysisplatform.github.io/bap/api/master/argo...

I'm not convinced that OCaml is unsuitable for such tasks.


I don't know enough to judge. I do feel that people generally (especially functional people) overestimate the overlap between maths and programming - I think maths is just the most useful toolset in programming, but isn't really what programming is about. So I can see why people feel C, with most of its metaphors derived from how (old) machines work, is perhaps a better fit for fundamental stuff than functional languages, that tend to derive their metaphors from maths.

That said, I don't know if this makes sense in a out-of-order, parallel world. I think as an organizational schema, imagining a machine that's doing things works better when that machine is relatively intuitive and simple.


> maths is just the most useful toolset in programming, but isn't really what programming is about.

It's not about maths, actually. You don't need to understand much math to comprehend monads, you need math only to reason about some properties and formal verification.

So think of monads as of codification of imperative effectful computations in a more general way.

I really like that example:

https://binaryanalysisplatform.github.io/bap/api/master/Mona...

What monad's bind does is just binding a step of computation to the rest of computation, so it is nothing new but a small step (operational) semantics written explicitly. That's why haskell has this do sugar that looks like as an imperative computation. Because it is a first class imperative computation.

Do you want first class features (functions, computations, effects) or features baked into the language is a subjective matter of course.


That's fascinating, actually! Thanks for sharing. I'm not particularly partial to either side of the discussion - I like engineering considerations, and I also like really abstract computer science. I think people tend to specialize and polarize in a way that's more reflective of social structure than technical possibilities, which is a shame.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: