Top
Best
New

Posted by ingve 15 hours ago

Gleam doesn't compile to Erlang source anymore(gleam.run)
281 points | 119 commentspage 3
quietFalcon 12 hours ago|
[flagged]
Tiberium 12 hours ago||
LLM bot.
zachrip 12 hours ago||
Did you read the post?
jazzypants 10 hours ago||
Let me guess: still no string interpolation in a language ostensibly intended for building user interfaces?
lpil 9 hours ago||
Gleam is not ostensibly intended for building user interfaces.
whalesalad 9 hours ago|||
I still don't know what gleam is for tbh. I like it conceptually. But interop with for instance elixir libraries is not as seamless as you'd like.
__jonas 9 hours ago|||
I use it mostly for web APIs / services, it's great for that!

Interop is not seamless since Elixir does not have the same static type system, but it is possible and that does help sometimes. When resizing images for example, I fall back to Elixir's bindings to libvips. I've also used Oban from Gleam in the past.

lpil 8 hours ago|||
It's a general purpose programming language, like OCaml, Python, or Scheme. It's not intended for any specific business domain.
jazzypants 8 hours ago|||
Then, why is JavaScript a compilation target? If you're not using it on the client-side, then why not stay exclusive to the BEAM?
lpil 8 hours ago|||
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.
yladiz 8 hours ago|||
You can do a lot more with JavaScript than building UIs.
jazzypants 8 hours ago||
Yeah. I know. I use it every day. That doesn't answer my question. Why would I want to write something in Gleam if I want it to run in a JavaScript engine? When would that ever make sense? Could you please just engage with me in good faith?

Multiple compilation targets require increased implementation complexity so you would think they would have a good reason for when you would compile to one target or the other. I couldn't find any information about it on their website, so I was hoping you would actually respond with something helpful rather than... that.

yladiz 8 hours ago||
So, you started by making a pointed comment about that the language has no string interpolation when it's ostensibly for building UIs, so I'm not sure why you're surprised you're getting responses like mine or the one from lpil. Gleam is not ostensibly meant for building UIs just because it targets JS, and while you don't get string interpolation in the way you might get in other languages you can go pretty far with the <> syntax.

To answer your question about why you would use Gleam when you're running code in a JS engine, it's the same about any language that compiles down to another, such as Clojure, and you can take your pick of those reasons: preference, syntax, pragmatism, etc. I'm not sure what kind of answer you're looking for beyond that.

jazzypants 8 hours ago||
I'm looking for the intention behind it. They chose two compilation targets. That made things harder. They had a reason. That's what I'm asking about.

None of your reasons ("preference, syntax, pragmatism") fully explain the situation without more context. Whose preference? What syntax are users even seeing? Why is it pragmatic?

Compilation targets are generally chosen based on performance characteristics and where the code is actually expected to be run. If you're not expecting the code to run on the client, then there's no reason to use JavaScript. V8 performance is better when single-threaded, but then why use the actor model?

When I go to the ClojureScript website, they have a whole section about why they chose JavaScript as a compilation target[0]. Notably, it mentions the word "client" multiple times.

[0] https://clojurescript.org/about/rationale

Blackarea 1 hour ago|||
It's a general purpose language (as mentioned several times) and compiling to js eg. for lustre webapps (elm-ish). I've contributed to the js compiler once only and can't find a way to use more gleam at my job but I'd say having failsafe actor based erlang backend + ssr + rich strongly typed reactive frontend all in one language is really cool.

It seems your stuck on js-only for ui and somehow rejecting compile to js. If you don't wanna use it fine but I'm not sure what you're looking for in this thread...

dematz 10 hours ago||
gleam is very much a language of "no" which if you like that, cool, if not, also cool :)
phcreery 11 hours ago||
The misuse of commas is distracting; at least it’s better than reading ai blogs.
gamache 10 hours ago||
Your semicolon would be more effective as a comma followed by "but". HTH
dominikh 11 hours ago||
Which commas are misplaced?
Joker_vD 10 hours ago||
Before the "and", "but", "so", "while", etc. — while most European languages, indeed, (usually) require commas before conjunctions, English is following a somewhat reversed convention. Well, at least the author remembered that they need to omit a comma before "that".
shakna 10 hours ago|||
Apart from in Australian [0] and Canadian [1] English, where it is generally optional, but used where it can increase clarity or meter.

[0] Australian Government Publishing Service's Style Manual for Authors, Editors and Printers, ISBN: 978 0 7016 3648 7

[1] The Canadian style: a guide to writing and editing https://archive.org/details/canadianstylegui0000unse

pipe01 10 hours ago||||
As a non-native English speaker I'm always so self conscious when using commas, it feels like I'm always using either too many or too few
john_strinlai 9 hours ago|||
i dont think anyone actually cares unless you are in english class or someone wants to feel smug on the internet (you can ignore the 2nd one completely).
GrantMoyer 9 hours ago||||
Informally, commas are "misused" regularly even by native writers, and almost no one notices or cares unless the misuse is frequent and egregious.

Formally, most comma use is an issue of style, not grammar, and style guides differ on when they should and shouldn't be used. The main rule that's actually a matter of grammar is this: commas cannot be used to join two "clauses" (phrases which could be independent sentences) without a conjunction.

Joker_vD 8 hours ago||
So putting the commas in "I'm eating a hot dog, she's listening to radio, we are having a wonderful time." is grammatically wrong? TIL, I guess.
GrantMoyer 8 hours ago||
English has no central authority, so the lines between grammar and style can get fuzzy. Most guides would say you need an "and" after the second comma, but some make an exception if the clauses are "very short and alike in form". See Wikipedia's article Comma splice if you are interested in the pedantics. https://en.wikipedia.org/wiki/Comma_splice
Joker_vD 6 hours ago||
You still didn't answer: am I supposed to write "I'm eating a hot dog she's listening to radio" without a comma for that sentence to be grammatical? Or am I supposed to always insert "and" into it?
GrantMoyer 6 hours ago||
With or without a comma, without a conjunction like "and" the example is a run on sentence and is ungrammatical. You should join the clauses with a conjunction, and including a comma before the conjunction is a common style.

There's a caveat where some style guides permit using a comma without a conjunction in specific contexts, but most don't.

zulux 9 hours ago||||
Don't worry about it.

The lack or excess of commas doesn't upset any reasonable person in the slightest.

steele 10 hours ago||||
You're doing fine. English grammar pedants speak infrequently. Mostly due to the disinterest of the listener.
tenuousemphasis 10 hours ago|||
As a native English speaker, same.
sarchertech 10 hours ago|||
You do need a comma before a conjunction if it connects two independent clauses.
Joker_vD 9 hours ago||
So it's "You do need a comma before a conjunction, if it connects two independent clauses" then — "you need a comma before a conjunction" and "it connects two independent clauses" are two fully formed simple sentences, each having its own subject and predicate. See what I mean?

And almost nobody writes sentences like "I love her and she loves me back" with a comma before "and".

nwalkr 11 hours ago||
idk, i'm not sure about wording. erlang abstract form still is erlang source, it's ast of erlang source text. one call to erl_prettypr:format and text source is back. word 'transpiler' is still there and there is nothing "pejorative" in it, it's transpilers all the way down everywhere.

but talking pejorative, i was surprised. my opinion of gleam was already pretty low, but i did not expect to see post-1.0 compiler emitting text erlang source. maybe it's not that good of idea to implement compiler in language completely foreign to target ecosystem.

lpil 9 hours ago|
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.

capitanazo77 7 hours ago|
When will they change their image to not look like girl toys?

Imagine a doctor about to do surgery and opening a toy box

atollk 7 hours ago||
I have never seen a software developer be insecure about their manhood because of the programming language they use. This is equal parts funny and sad.
hinkley 4 hours ago||
I’m old enough to remember VB developers so unfortunately cannot concur.
omnimus 7 hours ago|||
It's not surgery is it. It's programming language and their maintainers like it.
throwaway27448 7 hours ago|||
I'm struggling to imagine how this even comes up.
ginkogruen 7 hours ago||
Imagine your doctor is about to begin surgery and walks in with a camel, a crab and a gopher.
hinkley 4 hours ago||
And a weird little guy who looks like an artist’s eraser.