Gleam v1.9
gleam.run
gleam.run
Most of the great things I like about Elixir is tied to feature native to BEAM. (I think).
And I would expect that BEAM has not been ported to a Javascript runtime?
I would also expect at Gleam for Javascript can use and interact with Javascript libraries and what not, not possible under the regular version.
I would also expect that it is possible to write useful code that mill work on both platforms. but with a lot of limitations.
Do I have this completely wrong?
I guess if you've transpiled Gleam to JS then is calling a JS function even FFI anymore?
Elixir is also quite a lovely language even when not using any BEAM specific functionality! I used it a lot for writing regular sequential programs.
Thanks for all your work, great to see how well the language and tooling are maturing.
Printf is the only way to reliably debug multi threaded programs.
Sure print being a function has slight benefits in certain cases but the Gleam team also makes very compelling arguments to implement echo as a special keyword.
So what do we learn from that? Maybe don't do breaking changes to your language. Maybe debugging and actually printing should be separate things, one a statement, the other a function? I don't know.
I’m not sure it’s possible to extrapolate any lessons for Python from this Gleam language feature or the chosen syntax.
There are disadvantages of blurring the lines of what a function is an can do. Gleam values clarity above all things, so we don't have back-doors or special-cases. Everything plays by the same rules.
If you already have lots of Elixir in production, or you enjoy Elixir's highly dynamic approach to solving problems and would like to get some additional safety for free then sticking with Elixir is a no-brainer!
If you'd like a simpler language with tighter static analysis guarantees while still being able to dip into the wider ecosystem then you might prefer Gleam.
Ultimately I think the two languages have very different philosophies and idioms, folks will naturally find themselves preferring one or the other ^.^
I don't particularly want to gatekeep "Rust fans who just want to write lots of Rust" off OTP. Let them have Gleam. Maybe they'll figure out how to lifetime-annotate binaries?
What do you mean by this, I know how lifetimes work in rust, but how would you do it on the binary level ?
Beyond being functional and sharing a runtime I don't think Elixir and Gleam have much in common at all. Our recent developer survey showed that the majority of Gleam programmers were not Elixir users and largely were not attracted to that language.
> Our recent developer survey showed that the majority of Gleam programmers ... largely were not attracted to that language.
I must admit that I find that fairly bizarre. What do you imagine the source of that lack of desire is?
For context, my favorite language is F# and ML-dialects in general, but I also like what I call "principled" dynamically typed languages like Scheme, Racket, Erlang, and Elixir.
Gleam grows the BEAM ecosystem by bringing people in from elsewhere who were not interested in writing Elixir, Erlang, or LFE.
> I must admit that I find that fairly bizarre. What do you imagine the source of that lack of desire is?
They're just very different languages to work with. The programming experience is very different.
The point is that beyond some basic typing things, programs written in Erlang, Elixir, and Gleam will all have the same core structure. Immutable data plus pattern matching plus BEAM processes has a pretty strong affect on any BEAM language.
I dunno... Scala, Clojure, and Groovy users? Small user bases, but the languages are not dead.
I find the opposite more troubling, actually. Take the C# ecosystem and see how there's one de-facto application framework (.NET), one logging lib, one etc... It's usually Microsoft's way or the highway, and 3rd party libraries and frameworks struggle to get any adoption. Consequently, that ecosystem is much smaller, less diverse, and less innovative.
I understand that, but why then is OTP then limited on Gleam? Is interop to Erlang different than it is in Elixir? Elixir doesn't offer Elixir versions of a *lot* of OTP, but its Erlang interop feels quite natural (though not seamless). Can you just farm out to Erlang in Gleam? Does Gleam's static typing hinder this at all? Of course I can look this up for myself, but figured I'd asked here for the benefit of others since you're the author of Gleam :)
RE named processes, that's coming in the next release, and there's already multiple registry modules implemented in Gleam, including one funded by the Erlang Ecosystem Foundation.
Ya that's what I was asking about, mostly the interop. But I can just look it up :). Thanks, Louis!
I have used gleam and my own FFI, calling erlang from gleam isn't difficult.
What I found convinced me it wasn’t for me.
1. Language behavior depends on the back end. Int doesn’t necessarily mean Int.
> When running on the Erlang virtual machine ints have no maximum and minimum size. When running on JavaScript runtimes ints are represented using JavaScript's 64 bit floating point numbers.
2. If it’s not an Int it’s a Float. Short numeric tower. I guess that’s ok. No BigInt with a guarantee it will not overflow? No exact Rational?
3. Type annotations [are optional and] “don’t change how the program runs”.
Ok this sounds like Python. Supposedly there are guarantees indicating “if it compiles it runs” but I’m worried. How do you even know the inferred type of your function is what you really think it should be? (I’m familiar with inference gone crazy from Haskell.)
By adding a type annotation? Am I missing something?
Python's type checkers are optional. They only verify code with annotations.
Gleam's type checker is mandatory, so it is impossible to compile code without type checking being performed. Type inference and checking are always fully performed, and adding type annotations doesn't make the compiler perform any extra checking.
> How do you even know the inferred type of your function is what you really think it should be? (I’m familiar with inference gone crazy from Haskell.)
Gleam doesn't have subtyping so this is typically trivial, but idiomatic code has all functions annotated for clarity. You can also hover in your editor, or read the documentation Gleam generates and publishes from code automatically.
I don't expect I'll ever use Gleam at work, but the language does look very appealing to me and fun to use.
There's also an Exercism track that has exercises contributed by Gleam's creator: https://exercism.org/tracks/gleam
https://github.com/GetFirefly/firefly
AFAIK it's been mothballed and one of the major contributors seems to have left the BEAM ecosystem altogether. They're doing Ethereum-ish smart-contract-ish stuff now. The other top contributor looks to have pulled way back from OSS dev of any kind.