Better HN
topnewbestaskshowjobs
Log inSign up

lpil

1,188 karma · joined Mar 17, 2016 (10y ago) · 314 submissions

Submissions

comment 2w ago · link · parent

No problem!

I don't have anything formal to share, but in my testing I've found it works much the same in all languages now.

comment 2w ago · link · parent

Programming models have been sophisticated enough for some time to not be restricted to specific languages. It's rather like the difference between a junior developer (who knows how to use a specific language) and a mid developer (who knows who to program generally).

comment 2w ago · link · parent

Why's that?

comment 1mo ago · link · parent

No AST was ever used for that. Printing algebra was used in the past, and the new Erlang binary and textual generators both work by appending to a buffer. Your assertion that we need an AST has never been correct. From my point of view it would be wasteful and slow for the compiler to construct this AST just to then consume it to push bytes to a buffer.

RE punctuation, the book-keeping required for the binary format is no less work than for the textual format. All these formats are similarly easy to implement, though the ones that are not human readable are more challenging to debug.

comment 1mo ago · link · parent

Right, and I’m explaining that my multiple years of experience teaching and helping newcomers that an expectation of similarity to Rust frequently results in difficulty, and that it is beneficial to downplay any perceived link.

comment 1mo ago · link · parent

The old one had an inferior implementation, but that is unrelated to the output format. We also have a new Erlang source code generator that is used predominantly in the compiler test suite, and it too is superior.

comment 1mo ago · link · parent

This shows only the base syntax and has nothing of the language functionality, so is incapable of showing overlap between the languages.

comment 1mo ago · link · parent

Yes, exactly my point! Being a Rust user doesn’t mean you are going to prefer or even understand Gleam.

comment 1mo ago · link · parent

LFE used to compile to core Erlang, but it now also compiles to abstract forms.

https://github.com/lfe/lfe/blob/387d0aa1092bdda0ca17481869e8...

https://github.com/lfe/lfe/blob/387d0aa1092bdda0ca17481869e8...

comment 1mo ago · link · parent

The title says it no longer compiles to Erlang source. That's true, it now compiles to an IR of the Erlang compiler.

comment 1mo ago · link · parent

Aye, I am saying that jumping from Rust to Gleam isn't easy because the languages are so different. "How do I do X in Gleam like I would in Rust" is one of the most common categories of support question from newcomers who assumed they were similar.

It can take a moment to understand that things are done quite differently in the two languages due to being so different: https://gleam.run/frequently-asked-questions/#How-does-Gleam...

comment 1mo ago · link · parent

The ML family clearly inspired Rust greatly, but the end result is very different.

comment 1mo ago · link · parent

For that sort of compilation target more flexibility is beneficial, so C, Wasm, LLVM IR, Cranelift IR etc are better than Go, Nim, and D in my opinion.

> cross portability/small binaries/fast compiled language which is fast to compile

You don't need native compilation to build fast single file executables for a program, there's ways one can achieve this with Gleam today. Bundling the BEAM into your Gleam application executable with something like Gleepack is one option, and this will produce smaller executables than Go will by default for many applications.

comment 1mo ago · link · parent

It's very possible that I'm misunderstanding you! I'm mostly just saying that Gleam is very unlike Rust, so if you pick it or avoid it for Rust related reasons you may not be making the most informed decision.

The languages that Gleam is most like might be Standard ML, OCaml, Elm, and F#.

comment 1mo ago · link · parent

I think a Rust programmer is more likely to prefer Gleam to Elixir, but I don't think there is much link between Gleam and Rust, and I especially do not thing that Gleam should only be considered over Elixir if you are already a Rust programmer.

comment 1mo ago · link · parent

Surprisingly yes! JavaScript's allocator and garbage collection system is quite well suited to immutable programming.

Rust is a very poor compile target as the compiler is slow and not commonly available, and the aspects of Rust that make it good for humans to write make it a poor choice for compilers to target. With humans the produced code is verified, but with a compiler the compiler is what is to be verified, so the inflexibility of Rust are largely a hindrance compared to other native compilation targets.

comment 1mo ago · link · parent

I don't think that's the case, Rust and Gleam have almost nothing in common beyond having static type systems, and those type systems are very different too.

https://gleam.run/frequently-asked-questions/#How-does-Gleam...

comment 1mo ago · link · parent

Gleam is a simple functional programming language which leans into static typing , friendly tooling, and a one-way-to-do-it style. You'd want to use it if you enjoy the programming experience it provides.

comment 1mo ago · link · parent

It's a general purpose programming language, like OCaml, Python, or Scheme. It's not intended for any specific business domain.

comment 1mo ago · link · parent

JavaScript is useful in lots of places, and even if one compile target is especially good for in-browser user interfaces that doesn't mean that language is specifically intended for user interface development.

comment 1mo ago · link · parent

Go's garbage collection isn't well suited for an immutable language like Gleam, so the performance would likely be disappointing compared to other targets.

comment 1mo ago · link · parent

Gleam is not ostensibly intended for building user interfaces.

comment 1mo ago · link · parent

I don't think your "it is source as you can convert it back into source" argument holds water as all the Erlang formats can be decompiled into Erlang source code, including the final bytecode itself.

I think you're overthinking the cost of compiling to source, and also underestimating how common it is.

comment 1mo ago · link · parent

The only thing that would be needed for this is for 2 flags to be passed to the Erlang compiler. It would be very trivial!

comment 1mo ago · link · parent

We did not (and still don't) have an internal Erlang AST representation in the compiler. Previously we did have a Gleam AST -> printing algebra -> Erlang source pipeline, now we construct a buffer of bytes with the data encoded as Erlang Term Format.

Source was the previous target as at the time Erlang Abstract Terms was not established as the go-to format (Core Erlang was more popular but it did not have a stable API outside of the BEAM, so Gleam's in-Rust compiler could not construct it), and due to the newness of the language having an "escape hatch" where one could abandon Gleam and eject to Erlang was highly valuable. It also meant we could use the Erlang build tool until the Gleam one was ready for use.

comment 4mo ago · link · parent

This regularly happens with Microsoft's GitHub. You can also opt to not use Bluesky for authentication.

comment 4mo ago · link · parent

Yes, frustration with GitHub outages certainly made me start to look elsewhere.

comment 4mo ago · link · parent

I wish! Alas, the Gleam project continues to be under-funded and we have not got a single penny from any venture capital company.

If anyone would like to give me a large amount of money in exchange for my publishing a mirror on your git forge, please get in touch ;)

comment 4mo ago · link · parent

While the way that Tangled is funded is not my preference, I see great potential in atproto for improving the internet. This and and a lot of interest in the Gleam community for the protocol made me decide it was a good place to host a mirror of the Gleam repository.

comment 4mo ago · link · parent

Sorry, I don’t know what you mean.
12345
11