Elixir_of_ocaml

So its not worth, despite the fact its essentially the only thing to do, compared to a complete newly written from scratch solution?

What’s not worth?

1 Like

That you use Fez and simply add higher order module support and change the syntax to OCaml. Since this is the only thing to do, it could still be less work as doing everything from scratch. I have very less experience on that, so it might be otherwise. :slight_smile:

Less work than from scratch yes, but significantly more work than just make an ocaml compiler driver, which already would support that and a lot more. :wink:

1 Like

Interesting. Sad, that the existing documentation on these drivers is kinda under representing its true potential. Same can be said about higher order modules.

Hey, you once wanted to do a comparison between the different implementations in FSharp, OCaml and Haskell.

What do you say about this: https://www.quora.com/How-does-F-s-module-system-compare-to-OCamls-module-system

It’s a very “internal” feature, I do wish it were more documented by a lot though.

Not really? Those are very well documented. ^.^

because they were on an ideological quest to minimise the need for type annotations.

Which is one thing I really really like about OCaml. ^.^

Yet these practical challenges are all solved easily in F# code without benefit of a higher-order module system. Specifically, through the addition of two language features:

He’s forgetting one big thing, F# compiles those down to virtual function calls, I.E. they are not candidates for inlining or even single-assembly code generation unless the entire type path is known. In addition you can perform the same function in OCaml via witnesses, either via a function witness or first class module witnesses, and Implicit Witnesses will make passing those in implicit at that point, that way you will get not just the capabilities he lists ‘for free’ but anything needed needs or uses witnesses, not just some magical compiler-known primitive types.

In practice, higher-order modules are too heavy to productively abstract computations over arithmetic and the equality, comparison, hash and printing functions are almost always the same for any given type.

They are exceedingly ‘not’ heavy for that, that is the point of them. With witnesses you just pass the module in to the same function call, with implicit modules that will be done for you as long as the module is in scope. In addition they work for any form of type directed dispatch (kind of like haskell’s typeclasses except overrideable on a case-by-case basis unlike in haskell).

It doesn’t seem to me like the person in the post knows what first class modules are for. They are records that, unlike holding just values, can hold types as well, which is not something they ever brought up at all since quite literally everything in their post could be solved by records.

2 Likes