-
Notifications
You must be signed in to change notification settings - Fork 3
Why not write a Go backend for the OCaml compiler? #1
Comments
Thanks for this! It was really thoughtful, I appreciate it. There are definitely strong benefits for writing a Go backend to OCaml. My OCaml is mediocre but so is my Go so there's not a lot of difference there. One downside I could see is that OCaml has issues on Windows and incomplete support, I'm pretty sure, so going that route would mean you end up with targets Go (and thus Braid) could build for, but that the Braid compiler couldn't be run on. That's not optimal. Ultimately there were two reasons I chose to write Braid in Go:
Hope that makes sense! |
While I know that it isn't as smooth as on Linux, there is an answer on SO that probably works. On the support bit, yes, you may have a bit more trouble finding help, I agree, but usually people on Reddit/OCaml Disqus are happy to help.
By that logic, the C/C++/Go compilers should be written in assembly 😛
In Elm's case (at least the way I understand it from the outside), it is that Haskell has a lot of complexity which Evan thinks is not necessary for writing good front-end applications. However, in your case, it seems to me that Braid is much closer to OCaml (at least, in terms of target features). However, the bit about "fun" does make sense to me. It may not be as exciting to contribute to an already existing project as to create something new by yourself and freely experiment with things. Thanks for the answer! |
Yes, but if I commit to implement OCaml, I may find things that don't map well (for example, the "O" in OCaml is rarely used). Even if Braid ends up being close in terms of features, keeping it separate allows me to add or remove things that make more sense. For example, as Go has a strong story around interfaces, I might choose to implement Rust-style traits which would map well but don't belong in OCaml. I'd like to retain the ability to experiment. |
Disclaimer: I come here in peace, in an effort to understand your thought process, not to proselytize or ask you to change direction.
Looking at your goals, it seems to me that writing a Go backend for ocamlc (e.g. it already has a JS backend using Bucklescript, a bytecode backend, and a native code backend) fulfills all the goals.
I'm also listing some other pros and cons here.
Pros:
You benefit from
Unsure if Pros or Cons:
Cons:
Of course, there are lots of more considerations that I haven't listed here.
I'd love to hear your opinion on this idea/why you didn't choose to go this route?
The text was updated successfully, but these errors were encountered: