Live data from Hacker News

Wasm_of_OCaml

github.com

11–20 of 53 posts

Re: Wasm_of_OCaml

#11
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

It doesn't sound better in french. Any reasonable french version should be translated as "from".

Re: Wasm_of_OCaml

#12
post #10
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

It's just a dodgy French to English translation which then became 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...

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

#13
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

It doesn't sound better in french. Any reasonable french version should be translated as "from".

String: ficelle

Rope (advanced string): corde

Thread: fil

So string from object would like ficelle d'objet which is yeah, string from object. But the "of" thing in Ocaml is well documented. I vaguely remember them when I had an Ocaml project in my coursework.

Re: Wasm_of_OCaml

#14
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

I think it's a great convention. It means you write

    i = int_of_string s
where the "i" is next to the "int" and the "s" is next to the "string".

    i = string_to_int s
just looks backwards to me.

Re: Wasm_of_OCaml

#15
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

I assumed it was meant to evoke William of Occam.

Re: Wasm_of_OCaml

#16
post #14
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

I think it's a great convention. It means you write i = int_of_string s where the "i" is next to the "int" and the "s" is next to the "string". i = string_to_int s just looks backwards to me.

The topic here isn't so much the order but whether "of" in int_of_string matches a common/typical usage of the word.

From the other comments sounds like its local style for OCaml maybe because of some French lineage, but that "int_of_string" is a function that converts a string into an int was definitely not something that I would have assumed (as opposed to 'int_from_string' or something).

Re: Wasm_of_OCaml

#17
post #12
post #10

Earlier quoted context omitted.

It's just a dodgy French to English translation which then became 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...

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.

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

#18
post #9

Sorry in advance for bikeshedding. This is a cool project and the name is clearly derived from js_of_ocaml, but does anyone know why js_of_ocaml ended up with such an awkward name in the first place? I am vaguely familiar with the "x_of_y" naming scheme in OCaml (which I also find awkward, but perhaps it sounds better in French) - is that the only reason? I can't find any discussion online, so maybe I'm really the on…

I am French, but I feel this matches definitions 2a and 3 on https://www.merriam-webster.com/dictionary/of :

* "used as a function word to indicate origin or derivation, eg. a man of noble birth" (js code comes from ocaml code)

* "used as a function word to indicate the component material, parts, or elements or the contents, eg. throne of gold / cup of water" (js application made of ocaml code)

Re: Wasm_of_OCaml

#19
post #12

Earlier quoted context omitted.

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.

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.

...except that the original ML uses the same syntax, and it's Scottish.

Re: Wasm_of_OCaml

#20
post #19

Earlier quoted context omitted.

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.

...except that the original ML uses the same syntax, and it's Scottish.

Oh interesting, nevermind then. This makes me question the french explanation for the other thing too.
Post reply on HN