Live data from Hacker News

Programming a space invader in OCaml and OpenGL: lessons learned

marmelab.com

91–100 of 120 posts

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#91
post #40

Earlier quoted context omitted.

In fairness, it's dead because it was shitty and made most things harder, and the things it did improve JS copied. If OCaml fixes its syntax, then we won't have any need for Reason.

There isn't anything to fix.

Dangling else comes to mind.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#92
post #2

The underlying OCaml naturally. Having learned ML via Objective Caml's predecessor, Caml Light, ReasonML seems to be just sugar coating for those with aversion to ML classical syntax.

That's one of the main ideas, certainly. The thesis is that there are a ton of people who would take one look at the ML syntax and go back to their Java/C#/JavaScript, not realizing there's more to it. But with Reason syntax (which btw was designed by the creator of Merlin), they would take another deeper look.

For people like you and me, we like the ML syntax and don't have too much need for a new one. But for many others, this may be the only way they will ever even decide to look at an ML. And hey–if after that they decide that they actually like the ML syntax better–well that's one of the 'secret' goals of Reason.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#93

Earlier quoted context omitted.

TypeScript extends the syntax to support type annotations; it's not trying to fundamentally fix JS syntax.

Now enforcing type safety isn't a fundamental part of a language? I get the impression that you'd dismiss Rust as "basically C". ¯\_(ツ)_/¯

It is, that's the point. Reason is, as was said upthread, a "veneer". It changes the syntax only, nothing else is different (you can convert back and forth between the syntaxes losslessly). TypeScript makes deep changes to the language by adding type safety.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#94
post #81

> it is very complicated to install the base stack to develop in OCaml I'm not sure why the author decided to use such a complicated setup using Make and Docker. They could have just ran `opam switch create 4.09.0`, which would have created the compiler, then `opam install ...` for the dependencies. Still, an interesting article. I wouldn't recommending using OCaml/ReasonML for gamedev since getting it to work with W…

It is complicated to figure out a straightforward way to do builds in OCaml. If you're not tapped into the Current Way, you kind of have to read this blog, read that fragment, piece it together. I worked it through for a project of mine, and it was unusually unpleasant vs, say, Haskell. Docker because, presumably, he didn't want to dink with installing it locally.

I can't find it complicated at all. I control my OCaml builds mostly from simple, hand-written Makefiles. Reading up on the pertaining compiler and linker options is something you'd have to do for any compiled language. Building with dune isn't that much harder, either.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#95
post #86

> it is very complicated to install the base stack to develop in OCaml I'm not sure why the author decided to use such a complicated setup using Make and Docker. They could have just ran `opam switch create 4.09.0`, which would have created the compiler, then `opam install ...` for the dependencies. Still, an interesting article. I wouldn't recommending using OCaml/ReasonML for gamedev since getting it to work with W…

It's been a few years since I tried opam... When I did it just barfed out some obscure error message and I wasn't encouraged to try ever again. I realize that that's not really helpful towards improving the UX, but maybe it helps as a single data point? (Just to avoid accusations of : I actually discovered FP through OCaml and wrote a few early-ish libraries in the ecosystem, but then discovered Haskell... and the re…

Opam has gotten quite good. When you set it up, you're being guided through all the steps. Works best on Mac, with Linux a close 2nd. Windoze may pose some extra challenges for setting up a working environment.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#96

ReasonML is just an alternative syntax for OCaml. Often people use "ReasonML" shorthand for "ReasonML, converted to OCaml, compiled to Javascript with BuckleScript" and "OCaml" for "OCaml compiled natively" but it's perfectly possible (and actually really easy) to use OCaml with BuckleScript and Reason natively. Also note that despite the "O" in the name, OOP in OCaml is rare (for instance, there isn't any in the cod…

> Also note that despite the "O" in the name, OOP in OCaml is rare (for instance, there isn't any in the code in the article).

Which is kinda sad, because it has one of the best OO type systems in the industry, in my opinion. The decoupling of inheritance and subtyping, in particular.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#97

Earlier quoted context omitted.

I agree it's quite annoying to set up an OCaml project, and all the Jane Street stuff makes it even more confusing for newcomers. But to be fair, it may be the case with other languages as well. I recently tried to learn some Javascript, and I spent some time understanding the tooling and package management (npm/yarn, bundling, transpiling, node vs browser, difference between javascript versions).

What's the answer to the confusion around the Jane Street stuff? Do you recommend it for newbies?

Good question. Their libraries are robust and certainly useful if you want to develop real applications. I'm not sure but I'd say no because I think they add an extra level of complexity of a newbie. They are also quite opinionated which some people may dislike.

I talked about "confusion" because I suppose a newbie may quickly be confronted with this question, for intance if they want to follow "Real World OCaml" which is based on Jane Street libraries.

The tooling around OCaml has really improved a lot these last few years (opam, dune, core/async, merlin, ppx...). The downside is that it raises the bar for newcomers.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#98

Earlier quoted context omitted.

Typescript makes virtually no changes to JS syntax, except what's necessary to support types.

TypeScript classes, constructors and enums say hi. Talk about moving the goalposts...

Maybe I just don't have enough experience, but I use classes in Javascript and TypeScript, as well as constructors, and they look virtually identical to me. What am I missing here?

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#99

Earlier quoted context omitted.

If you were right OCaml wouldn't be the only language with a popular syntax veneer.

On the other hand, if Reason were such a massive improvement to OCaml syntax, where are the people clamoring for F# to adopt more of Reason's ideas? (Admittedly, F# already shares a couple Reason ideas like C-style comments instead of OCaml's traditional ones. So the waters are clearly muddy here to begin with, but a lot of the big things like let-binding scopes and ;; versus ; presumably would be big F# requests if…

F# already has the main things people like about Reason.

Re: Programming a space invader in OCaml and OpenGL: lessons learned

#100

Earlier quoted context omitted.

I agree it's quite annoying to set up an OCaml project, and all the Jane Street stuff makes it even more confusing for newcomers. But to be fair, it may be the case with other languages as well. I recently tried to learn some Javascript, and I spent some time understanding the tooling and package management (npm/yarn, bundling, transpiling, node vs browser, difference between javascript versions).

.NET you install either Visual Studio or just the SDK and everything just works. And it's not just the initial setup. It's the best debugging experience available. It has a robust extension system, though honestly, you don't need to engage it and you're still having an amazing experience. For a while, I grumbled that it had spoiled me for other languages, the "fun" looking stuff that everyone talks about online. But…

VS installation is also a PITA if you have your C:\ on an SSD. The installer doesn't give you choice of what partition to install to (for most of its huge disk space demands) so you need to fake it with a bunch of symlinks. The VS team recognizes this problem but doesn't do anything about it, as follows from the comments on https://developercommunity.visualstudio.com/content/problem/...
Post reply on HN