Live data from Hacker News

We chose OCaml to write Stategraph

stategraph.dev

61–70 of 127 posts

Re: We chose OCaml to write Stategraph

#61

Earlier quoted context omitted.

Fair. Agda, gallina, f* maybe? My point was that without any escape hatches or magic you can code a segfault starting in ocaml5. That may be true of haskell? It is true of rust too, though the only known way to do it isn't something that is likely to happen by accident and is tracked as a bug. In ocaml5 if you use domain, it is down to experience skill, and some luck to be sure you used atomic when necessary. I'm a b…

Shouldn't most application programmers in OCaml be reaching for EIO or some other well-tested abstraction?

When there was no true concurrency, only preemption, eio was safe. Not now, you can still clobber things.

Edit: i was wrong! Since at least 5.1 it catches the cross domain access and errors gracefully.

Re: We chose OCaml to write Stategraph

#62

I hope for the team to settle with a FLOSS license, so it becomes feasible to evaluate for everyone.

We're still figuring out what balance makes sense between openness and sustainability, and we'd rather take the time to get it right than rush into a license we'll regret later. The goal is for Stategraph to last a long time.

Re: We chose OCaml to write Stategraph

#63

My concern for a team language choice is "How hard is going to be be hire people to write in this language effectively and how much will /they/ enjoy it?" It's one thing to pick a language that I like and am productive in, it's another to choose a language for a larger team. If you've found an full team of motivated and capable OCaml coders, great.

It has not been a challenging finding candidates for OCaml. For the most part, people who like OCaml are chomping at the bit to find a job writing it. And for those that don't know OCaml, a lot of really good devs are excited to try something different.

Re: We chose OCaml to write Stategraph

#64

Earlier quoted context omitted.

But what is functional besides haskell? Purescript? Elm I guess. Ocaml is not. It has for loops even. You can write pure functional ocaml but people don't. It mattered a lot less when it didn't have true concurrency, but now clobbering things in ocaml is quite possible.

FP has nothing to do with mutability. You seem to lack a basic understanding what the common FP languages are, and what FP actully is.

Pure functional programming languages do not allow mutable state. They can simulate it with monads, and they typically have impurities to allow io sode effects, but a for loop is an inherently imperative construct. Mostly functional languages like ocaml have things like ref. Functional languages aren't just about functions being composable and having no side effects, they also require that once a value is bound to a name, that it does not change. That isn't just pedantry either, it is what allows safe concurrency by default.

Re: We chose OCaml to write Stategraph

#66

I like OCaml and have written the "why we chose XYZ language" posts. Most of the time the real answer is "we like it and it makes us feel good to use it". Like the answers aren't wrong per se but they're more post-facto justifications. And that's perfectly fine! I think we should normalize saying that tech stack choices are subjective and preference-based. We're not robots. The social and aesthetic parts of a stack m…

> I think we should normalize saying that tech stack choices are subjective and preference-based. We're not robots. The social and aesthetic parts of a stack matter to people I would just like to distinguish "subjective and preference-based" from "social and aesthetic" and also clarify some notions. 1. The social is objective. We are social animals. It is essential to what it means to be human. We need social relatio…

I’m sorry but there is no way you can demonstrate a universal aesthetic. Your opinion of other people’s tastes does not reflect on their taste — it reflects on yours.

Re: We chose OCaml to write Stategraph

#67
post #65

TIL (via a rabbit hole after reading this) that a good type system removes an absurd amount of boilerplate validation code.

Do you have any good resources on this subject? I agree and would like to see what a persuasive argument for it looks like.

The very classic parse don't valide if you haven't already read it : https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

Re: We chose OCaml to write Stategraph

#68
post #25

Is any of this OCaml specific? You can check all boxes with TypeScript.

Those two type systems are not the same. Typescript has some soundness issues in the type system. They are there because they have to work seamless with javascript so it's understandable. And they improve many codebases that would have been otherwise written in javascript. But they do not in any way give you the same level of guarantees that OCaml, Haskell, or Rust would give you.

For all practical purposes I believe it does the same thing.

Re: We chose OCaml to write Stategraph

#69

Earlier quoted context omitted.

Define functional? Even Haskell is not functional in the strictest sense. It has unsafe IO. It can throw exceptions. Functions may not halt.

Fair. Agda, gallina, f* maybe? My point was that without any escape hatches or magic you can code a segfault starting in ocaml5. That may be true of haskell? It is true of rust too, though the only known way to do it isn't something that is likely to happen by accident and is tracked as a bug. In ocaml5 if you use domain, it is down to experience skill, and some luck to be sure you used atomic when necessary. I'm a b…

> you can code a segfault starting in ocaml5

It shouldn't, the OCaml 5 memory model bounds the reach of data races in both space and time. [1] Thread-unsafe code won't be correct when misused, but it will stay memory safe unless you reach for an additional escape hatch (or you find an implementation bug of course).

[1]: https://ocaml.org/manual/5.4/memorymodel.html

I'm much more concerned about the amount of poorly vetted escape hatches in wide use in OCaml, mainly for bindings.

Re: We chose OCaml to write Stategraph

#70

Earlier quoted context omitted.

FP has nothing to do with mutability. You seem to lack a basic understanding what the common FP languages are, and what FP actully is.

Pure functional programming languages do not allow mutable state. They can simulate it with monads, and they typically have impurities to allow io sode effects, but a for loop is an inherently imperative construct. Mostly functional languages like ocaml have things like ref. Functional languages aren't just about functions being composable and having no side effects, they also require that once a value is bound to a…

Ocaml is immutable. It has ref if you need mutation, this is not the default thing you grab tho. Haskell has unsafe and IORef, that does basically the same thing. Scala, rust etc has all escape hatches.

A loop by itself is not non-fp, as i can do the exact same thing via recursion. Its just syntax.

Hell, i can write a never halting program in lambda calculus with a fixed point combinator causing "undefined behaviour".

Post reply on HN