News for hackers. Stuff that matters.
Re:Elm 0.19 Broke Us by Tehnix on Saturday August 25, 2018 @06:05PM (#17842840)
I think there’s a very weird mismatch between the way the core language people are pushing for the adoption of the language, and then at the same time they will turn around and say “we’ll, it’s not even 1.0, yet, so what’d you expect”.

The way Elm is developed is fit for a language that has little to no users, and can take going so long between updates, that remove escape hatches needed to fill out the immaturity of the language.

It really saddens me to see it go like this, because I once had high hopes for Elm. Nowadays I see it purely as a stepping-stone into more advanced languages like PureScript and Haskell. Elm is there to hold your hand, but it seems it has no intention of ever taking you further than the basics.

Re:Elm 0.19 Broke Us by erokar on Saturday August 25, 2018 @06:09PM (#17842852)
What you term the "immaturity of the language" is imo a well thought put focus on simplicity. It was never Elm's intention to reach the complexity of Haskell or indeed PureScript. I think that was a sound decision.
Re:Elm 0.19 Broke Us by mikekchar on Saturday August 25, 2018 @08:53PM (#17843531)
I think you are right, but the way decisions are communicated in Elm are frustrating. There are lots of decisions like this, which in the end are just decisions, but can be frustrating if you are expecting a more complex language.

Even without talking about type classes, the lack of applicative is weird. I know: nobody understands what applicative is for, but if you have map and you are currying parameters, you're going to run into the issue ;-) Instead, you've got map, map2, map3, map4, map5 (which also, frustratingly, don't implement applicative). There are lots of validation scenarios that are just way more complex to do in Elm than they need to be.

But to be honest, it's fine because the language is not supposed to give you everything that you might want. It's geared for people who want a subset that's easy to learn. If I'm going to write code for myself in this space (functional language that compiles down to JS), I'm going to pick Purescript because it has everything that you're ever going to want. But if I'm choosing a language for my team that doesn't know functional programming and (to be blunt) doesn't really care to learn: Elm is a much better fit. They can learn just enough to get their work done.

But I just wish it was stated in those terms clearly. The premise of the article has been played out time and time again in the Elm community: "I thought this was a fully featured functional language, but when I tried to do this completely reasonable thing I got my hand slapped".

At every turn the response to, "Why can't I do X" is "Because you don't need to do X. It's much simpler to do without X" -- which usually isn't true. It's much simpler to learn something without X, but X is there to make your life much easier as long as you can deal with the complexity of learning it. It's the old "ease of use" vs "ease of learning" issue.

Re:Elm 0.19 Broke Us by always_good on Sunday August 26, 2018 @04:46AM (#17844968)
On the other hand, people need to learn to take no for an answer and move on.

Instead, egos get involved and a new essay of the week appears on how Elm is doomed because it doesn't have <pet feature>. That nobody can take Elm seriously if it doesn't have type-classes, synchronous FFI, derivable JSON codecs, component state, or whatever the pyre was built on that day.

If you didn't know better, you'd think they were disgruntled paying customers.

Elm's simplicity, lack of abstraction, and resulting boilerplate have more to offer than helping beginners learn. Nothing demonstrates this better than coming back to an old Elm application and immediately making meaningful changes to the code despite a long hiatus from using Elm at all.

There are a lot of languages that continually add features in this space like PureScript, ReasonML, and even TypeScript.

Why not see where Elm ends up with its aggressive devotion to a minimal API instead of trying to turn it into a language we already have?

Some of the best aspects of Elm come from its restrictive nature. Like how every Elm application uses the same "TEA" abstraction which is a breath of fresh air for anyone who never felt particularly empowered by the paralyzing abundance of options in the JS ecosystem nor the task of webpack-plumbing them together.

Re:Elm 0.19 Broke Us by vmchale on Sunday August 26, 2018 @09:30PM (#17848876)
Nobody can take Elm seriously because having lines of code in Elm is a liability at this point.

If Evan hadn't wanted this to happen, he shouldn't have positioned it as the "beginner-friendly" language and then pulled the petty dictator routine out as soon as people were locked into his ecosystem.

> Nothing demonstrates this better than coming back to an old Elm application and immediately making meaningful changes to the code despite a long hiatus from using Elm at all.

Or... not having it compile because the BDFL (or, realistically, DFL) has decided to remove half the features it needed to compile.

Re:Elm 0.19 Broke Us by iodiniemetra on Saturday August 25, 2018 @06:17PM (#17842885)
That's not the takeaway that you should have - simplicity doesn't matter if minor language versions make breaks.
[dead]
Re:Elm 0.19 Broke Us by alluro2 on Saturday August 25, 2018 @08:23PM (#17843423)
While I agree about it being ok to break things at this stage, some of the words in your reply were a bit confusing - what do you mean a "private unsupported API" in an open source project? Kind of supports the notion that this is a private group project and others can use it, but are not welcome to participate.

Also, if calling this a minor release is idiotic, why was the version number then a minor increase (at least according to commonly accepted understanding, i.e. semver) and not a 0.20 or whatever else, especially if there are breaking API changes.

Re:Elm 0.19 Broke Us by uryga on Saturday August 25, 2018 @10:57PM (#17843962)
GP probably meant something like "an internal API that's exposed in case you need it but gives no guarantees about stability because it's still evolving"
Re:Elm 0.19 Broke Us by knewter on Sunday August 26, 2018 @02:25AM (#17844580)
> Kind of supports the notion that this is a private group project and others can use it, but are not welcome to participate.

Native's existence was an implementation detail. no one using it didn't know it was likely to go away if they read anything about it from core. it was undocumented, but where you could find any documentation it said very clearly not to use it. people used it anyway. I was one. but I knew going in that it would likely disappear.

> why was the version number then a minor increase (at least according to commonly accepted understanding, i.e. semver) and not a 0.20 or whatever else, especially if there are breaking API changes.

https://semver.org/#spec-item-4

you not understanding semver doesn't make elm bad

Re:Elm 0.19 Broke Us by fulafel on Sunday August 26, 2018 @06:30AM (#17845234)
Elm doesn't seem to use semver (which requires that "A normal version number MUST take the form X.Y.Z")
Re:Elm 0.19 Broke Us by vmchale on Sunday August 26, 2018 @09:31PM (#17848881)
Clearly the internal API existed because Evan et al. decided they needed to use it. So why did they decide it a feature that was so obviously necessary was too complicated for the hoi polloi?
Re:Elm 0.19 Broke Us by mst on Sunday August 26, 2018 @03:12PM (#17847333)
I asked upthread about native versus ports and somebody was kind enough to mention ports were async only.

But I'm still curious about exactly what people were using native for and why at least some users don't feel they can rewrite easily - care to share what you used and why, and what your thoughts are about replacing it?

(the discussion around this has, so far as I've been able to see, devoid of concrete examples, and now the question's nerd sniped me :)

Re:Elm 0.19 Broke Us by Zyst on Saturday August 25, 2018 @09:23PM (#17843657)
In semver versions before 1.0 are prerelease versions.
Re:Elm 0.19 Broke Us by vmchale on Sunday August 26, 2018 @09:26PM (#17848867)
No, "immaturity of the language" refers to Evan's tendency to make breaking changes for absolutely no good reason.

Use custom operators? Fuck you. Now go rewrite all the libraries you contributed to the community.

Re:Elm 0.19 Broke Us by dsiegel2275 on Saturday August 25, 2018 @06:34PM (#17842946)
> remove escape hatches needed to fill out the immaturity of the language

I think you mean "immaturity of the platform".

Also, native modules weren't the only "escape hatch". An Elm application can communicate with JS through ports.

Re:Elm 0.19 Broke Us by k__ on Saturday August 25, 2018 @06:36PM (#17842963)
Complicated interop with JS also broke Darts back.
Re:Elm 0.19 Broke Us by pjmlp on Sunday August 26, 2018 @02:52AM (#17844653)
Politics broke Dart's back.
Re:Elm 0.19 Broke Us by k__ on Sunday August 26, 2018 @06:50AM (#17845291)
Sure, the bad JS interop had to come from somewhere.
Re:Elm 0.19 Broke Us by AlexCoventry on Saturday August 25, 2018 @11:09PM (#17844004)
What was the capability of native modules which enabled the dev.to essayist to use them, where ports would have been unreasonable ("there is no other reasonable way to do what I need")?
Re:Elm 0.19 Broke Us by loevborg on Sunday August 26, 2018 @08:12AM (#17845587)
Check out this comment for an explanation of why Ports cannot possibly cover all use cases: https://www.reddit.com/r/elm/comments/99bzf8/elm_or_reasonml...
Re:Elm 0.19 Broke Us by big_elephant on Sunday August 26, 2018 @12:42PM (#17846637)
hm i'm not sure why ports would not work in that use case (the keycloak one, right?). the port would be how you communicate between js and elm, so it looks like inside the js callbacks is where you would `send` that data through the port to elm
Re:Elm 0.19 Broke Us by loevborg on Sunday August 26, 2018 @03:15PM (#17847348)
Agreed, it could work with Keycloak, or other 3rd party libraries, depending on the amount of collaboration between JS and Elm. My point was that some things that are simple when you can pass around promises suddenly get very complicated when all you have is ports and messages.
Re:Elm 0.19 Broke Us by AlexCoventry on Sunday August 26, 2018 @08:36PM (#17848719)
I came across an example which makes using ports sound a bit tedious (but suggests an alternative.) It's at the start of this talk:

https://www.youtube.com/watch?v=tyFe9Pw6TVE

Re:Elm 0.19 Broke Us by big_elephant on Tuesday August 28, 2018 @12:19AM (#17856528)
excellent video, thanks. custom elements are a very interesting alternative
Re:Elm 0.19 Broke Us by always_good on Sunday August 26, 2018 @03:46AM (#17844789)
Ports are an asynchronous interop boundary. You basically subscribe to a port from Javascript and attach a callback to handle data as it passes from Elm -> JS. Javascript errors then are relegated outside of Elm or they fail at the boundary (like serialization errors when passing data from JS to an Elm port). They're kept outside of Elm.

Native modules, on the other hand, let you create Elm functions that synchronously call Javascript. That means that what look like regular Elm functions can now synchronously blow up at callsite inside Elm.

The first native modules I saw in the wild as a beginner were people making shortcut functions for things like `Math.random()` instead of the proper way of threading a random seed into the entry point and keeping it in the model which has various benefits. Same with quick access to "Date.now()".

From this perspective, you can see why native module access was removed, and especially why you needed permission to publish a native module Elm's package repo. Native modules are tempting because they are easy, but widespread use eliminates one of the major upsides of Elm: no runtime errors inside Elm, or rather the ability to boundary them.

However, some forms of JS interop are hard or impossible without synchronous FFI, 1:1 JS library wrapping being the most obvious example. Having to use asynchronous ports for that is like wrapping a Javascript library's sync functions with an EventEmitter. You emit an event and then listen for the resulting event. Maybe you even decide to pass in a messageId echo for request/response reconciliation (I've seen people build this abstraction around Elm's ports!).

On one hand, a lot of people have the idea that because they are using Elm, they shouldn't have to write any Javascript at all. After all, this is what many compile-to-JS languages give you.

And on the other hand, no more synchronous FFI means that some Elm apps that exist today cannot move ahead, and some people think the approach is too heavy-handed or they disagree with the direction.

In my experience, Elm is best seen as a way to build a functional core that you wire up to an external world of Javascript. For example, a game simulation that emits game states over a port, and you write Javascript to render those updates with a JS library like Pixi.js, resisting the temptation to wrap Pixi.js in Elm and calling it from Elm.

Re:Elm 0.19 Broke Us by heavenlyhash on Sunday August 26, 2018 @07:51AM (#17845508)
> you needed permission to publish a native module Elm's package repo.

See, this, to me, sounds quite reasonable.

A feature is potentially dangerous to the rest of the ecosystem if encountered unexpectedly: therefore, we put some extra friction on sharing code which uses those features, and made it an obvious and opt-in process if you wished to take that potential danger into your project. Great!

Given that... why on earth would it be necessary to remove the feature from the language entirely?

Re:Elm 0.19 Broke Us by oomem on Sunday August 26, 2018 @09:31AM (#17845846)
You can find some explanations by the language author here:

https://discourse.elm-lang.org/t/native-code-in-0-19/826

Re:Elm 0.19 Broke Us by vmchale on Sunday August 26, 2018 @09:24PM (#17848864)
At this point it's barely a stepping stone. I'd recommend just diving in to Haskell or the like head-first so you learn the tools you'll actually use.

When you update this quickly (and for no reason), the learning resources go out of date too.