News for hackers. Stuff that matters.
Re:WASM_of_OCaml by frou_dh on Monday July 24, 2023 @12:31PM (#36850590)
It's just a dodgy French to English translation which then because a convention. Instead of e.g. to_string's buddy being called from_string, it was called of_string.

Here's a thread of reddit about it: https://www.reddit.com/r/ocaml/comments/6es88t/what_does_the...

Re:WASM_of_OCaml by nequo on Monday July 24, 2023 @12:41PM (#36850747)
I assume it also has a connection to how algebraic data types are written in OCaml. For example, the equivalent of Haskell's `Maybe` and Rust's `Option` is

  type 'a option = None | Some of 'a
So calling this project "WASM of OCaml" is one way of saying that it "wraps" OCaml code in WASM.
Re:WASM_of_OCaml by giraffe_lady on Monday July 24, 2023 @01:33PM (#36851508)
Right but why do they use "of" in that way for type declarations? Ends up being the same answer: it's a reasonable translation from french for a non-native english speaker.
Re:WASM_of_OCaml by wk_end on Monday July 24, 2023 @01:55PM (#36851812)
...except that the original ML uses the same syntax, and it's Scottish.
Re:WASM_of_OCaml by giraffe_lady on Monday July 24, 2023 @02:06PM (#36851974)
Oh interesting, nevermind then. This makes me question the french explanation for the other thing too then.
Re:WASM_of_OCaml by c54 on Monday July 24, 2023 @03:11PM (#36852911)
It's fairly colloquial english to say you have "some of something", I think this matches the ocaml language convention pretty nicely
Re:WASM_of_OCaml by dan-robertson on Monday July 24, 2023 @06:40PM (#36855248)
It’s somewhat hard for me to decide how unnatural a translation this is as I’m used to seeing it in ocaml. My concise dictionary doesn’t have a definition that fits this use well. My non-concise dictionary describes the history of the senses of the word as “exceedingly complex”.

It has been used as a translation of the French de since the 11th century and I think it gets some senses (eg derivation) from that. With a verb meaning create, this ocaml construction is fine in modern English (eg ‘make a string of an int’) and dates back a long way (OED offers a source from 893; this is sense I. [VII.] 20. a. in the second edition). So I think partly the question is whether omitting make in make_string_of_int (or String.make_of_int) is an acceptable abbreviation in programming.