Live data from Hacker News

My thoughts on OCaml

osa1.net

201–210 of 230 posts

Re: My thoughts on OCaml

#201

OCaml is one of those languages (like Raku and Nim) that I really want to learn and do something in at some point but usually end up not bothering because it's easy for me to just start up new personal projects in Python like I'm used to.

But you can always just try ocaml for the sake of it, for the fun of it!

Re: My thoughts on OCaml

#202

Related: https://twitter.com/zetalyrae/status/1639474931086901248 My OCaml: let foo (x: bar): baz = (\* Is this quuxable? *) match is_quuxable x with | Yes -> (* Then, we have to ... \*) All the OCaml I see in the wild: qlet%bind f = 's 't 'a 'b (fun ꙮ -> ꙮ ((

Functional programming community likes this stuff. They go into the classical mathematicians’ trap of writing more and more general versions of something even though it’s not necessary.

Until they get enlightened.

Related: https://willamette.edu/~fruehr/haskell/evolution.html

Re: My thoughts on OCaml

#203

I think you should give F# a shot instead. 1. No standard and easy way of implementing interfaces No problem in F#, you have interfaces, abstract classed, ... 2. Bad standard library In F# you have access to the full .NET standard library and ecosystem. There are also quite a lot of libraries that are especially designed to take advantage of F# (SQL libs for example). 3. Syntax problems 3.1 OCaml doesn’t have a singl…

I don't want to trust anything made by the Embrace, Extend, Extinguish company.

Re: My thoughts on OCaml

#204

Coalton [1] is an OCaml-like dialect of ML: it's strictly evaluated, has imperative features, and doesn't force a purity-based development philosophy. However, Coalton has S-expression syntax and integrates into Common Lisp. It works, and is used "in production" by its developers, but it's still being developed into a 1.0 product. Coalton made a lot of design decisions to work away from issues that this post describe…

Why does Coalton require two different implementations of Lisp to be installed?

Re: My thoughts on OCaml

#205

Earlier quoted context omitted.

The question is if modern versions of popular languages (java, c#) caught up on ocaml's syntax sugar, or maybe this syntax sugar is trivially replaceable by some utility functions. Maybe you could bring any example of such ocaml functionality?

Syntax and sugar is subjective, right? Instead, easier to discuss the layer beneath syntax, and that’s to compare the type systems. Java now has some version of sum types aka algebraic data types, but because of its beginnings, it may never feel as easy to use. And ease of use is important, as is evident from discussions here. Had to look up to see where Java is at for sum types. First link I found. https://sfietkons…

sum types is not something supercritical, it saves few lines of code.

Also, somehow I rarely have need to use something like that personally.

> And ease of use is important

the question is if insignificant syntax sugar worths switching to unpopular platform with undeveloped toolings and uncertain support.

Re: My thoughts on OCaml

#206

An alternative to OCaml is Flix ( https://flix.dev/ ) which attempts to address some of the critiques in the post. For example: > Bad standard library A particular goal of Flix is to have a consistent standard library based on type classes. > Standard types are sometimes persistent, sometimes mutable. List, Map, and Set are persistent. Stack and Hashtbl are mutable. In Flix immutable types are named List, Set, Map, e…

It pains me every time I find a great programming language and then find out that it runs on the JVM.

Re: My thoughts on OCaml

#207

OCaml is one of those languages (like Raku and Nim) that I really want to learn and do something in at some point but usually end up not bothering because it's easy for me to just start up new personal projects in Python like I'm used to.

Maybe try Nim next time you have something performance-sensitive, or OCaml when your problem can be elegantly expressed in a functional way.

Re: My thoughts on OCaml

#208
post #18

ReasonML and ReScript are a (more or less the same) new syntax on top of OCaml. ReScript only targets JS, while ReasonML targets both JS and the native archs OCaml supports. Facebook and Bloomberg are using ReScript internally, afaik. Messenger.com is written in it. Facebook also maintains React bindings to ReScript. https://rescript-lang.org/ https://reasonml.github.io/

Rescript is completely excellent imo. I have used ocaml for years and while I like it more than most languages it's also weird and frustrating sometimes. Rescript uses the best parts of ocaml (type system & exhaustive pattern match, first class modules) to patch over the worst parts of js. It's almost alarming how effective it is to combine these two gnarly hostile languages like this. I also work in typescript a lot…

How does that work with Fresh? Just not using its built-in "Islands" machinery at all? Or smuggling stuff in that as far as Fresh is concerned are more orthodox React components?

Re: My thoughts on OCaml

#209
post #134

Earlier quoted context omitted.

Those are examples of C and Java being very bad . So yea, I think my point stands.

I’m not sure I understand your point then because the code in the article is definitely very bad OCaml which is what I have been trying to tell you from the start.

It's very bad if a language community KNOWS something is very bad and they still allow that to be valid syntax. Like `if (x) break;` in Java/C/C++. It's VERY BAD.

Not fixing your language is a big red flag.

Re: My thoughts on OCaml

#210
post #192
post #136

Earlier quoted context omitted.

It sounds like it's weird and annoying to convert a value to a string. That's pretty damning. Did I misunderstand?

Primitive conversions are as simple as ` _of_ (myValue)`. For example, `int_of_float(2.0)` will give you an integer. `string_of_int(123)` will return a string. Noting very surprising. If you want to do more complex conversions, you have to write those functions and call them. I don't much care for Ocaml syntax (StandardML is a better language in basically every way and ReasonML is Ocaml with better syntax), but this…

That's terrible though. How can that possibly work if the type is not hardcoded? How can you write code that works on any type like that?
Post reply on HN