Hacker News new | ask | show | jobs
by the_benno 1868 days ago
This looks like a cool and interesting project, but some of the syntax choices seem a little... all over the place to me. It seems like it's drawing quite a bit of inspiration from ML-family languages without fully internalizing _why_ things are the way they are there.

Of course, that's all "just syntax" and not the end of the world.

Reason targets a similar use case* but, to me, makes a more sane set of syntactic choices and tradeoffs, while also having access to the whole OCaml ecosystem. I'm not sure why one would reach for Grain over that, though maybe I'm just not the target audience here.

* i.e. developers who want type safety, good inference, a familiar JS-ish syntax, and to target the web

edit: I see now that the compiler is built in Reason -- I'd imagine they've thought about these things and made considered choices on syntax!

1 comments

It's just Rust. For some reasons, many new languages these days seem to get inspiration from the Rust syntax. For example, when Rust first came out, people said its choice to use "fn" to refer to functions was awful. Now, it's everywhere. Even Zig is using it.

One of the reasons would be that Rust already made some reasonable choices regarding how to incorporate ML features into the C++-eseque syntax, so you don't have to worry about it. But it is indeed a bit sad that a more easy to use C++-eseque syntax that is substantially different from Rust isn't coming out nowadays.

I don't care so much about keywords like `fn` personally; I was referring more to:

- `let` in a statement language (as opposed to let-binding expressions)

- comma-separating patterns (as opposed to using pipes to mimic BNF, also potentially causing confusion vs. tuple/record constructors)

- whitespace rather than semicolons for sequencing (though I'd imagine others might disagree on that front).

Some of that overlaps with Rust, to be sure -- I didn't pick up on those similarities at first.

Grain has a considerably smaller focus than Rust, and seems to aim for much simpler syntax and development.

When targeting Webassembly with Rust, there is still a lot in the Rust ecosystem that can get in your way, and not a lot in the standard language that will help you, either.