← Back to context

Comment by Hasnep

2 months ago

I bounced off OCaml a few years ago because of the state of the tooling, despite it being almost exactly the language I was looking for. I'm really happy with Gleam now, and recommended it over OCaml for most use cases.

Can you use Gleam for ad-hoc scripting? In my mind that means two requirements that most languages fail at.

1. You can import by relative file path. (Python can't.)

2. You can specify third party dependencies in a single file script and have that work properly with IDEs.

Deno is the best option I've found that has both of those and is statically typed.

I'm hoping Rust will eventually too but it's going to be at least a year or two.

I always assumed a runtime specialized for highly concurrent, fault-tolerant, long-running processes would have a noticeable startup penalty, which is one of the things that bothers me about Python. Is that something you notice with Gleam?

  • I tried out Gleam for Advent of Code this year. There was a significant difference in startup times, about 13 ms for Python and 120 ms for Gleam.

    If you want something with minimal startup times then you need a language that complies to native binaries like Zig, Rust or OCaml.

Did you consider using F#? The language is very similar to OCaml, but it has the added benefit of good tooling and a large package ecosystem (can use any .NET package).

  • I've heard a lot of good things about F#, but I've also heard that C# has taken all the best features from F# and now development has slowed down. I don't know how true that is. It's also just some irrational anti Microsoft bias, even though I know .NET runs fine on Linux now, the idea still felt weird to me. I suspect if I'd actually tried F# I would have stuck with it.

    I have looked at the Fable compiler for F# which lets you compile F# to Rust which is very cool!