News for hackers. Stuff that matters.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by s_kilk on Monday March 05, 2018 @08:42AM (#16520943)
I'm a big fan of Elixir, but the community gravitation toward Elm has always struck me as a bit weird.

The two languages have nothing in common beyond both being functional, and it kinda feels like someone posted a "Elixir and Elm" blog post in the early days and it all just snowballed arbitrarily from there.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by jrobn on Monday March 05, 2018 @08:53AM (#16521006)
I think it’s mostly people who are writing in Elixir are, at this point, already on the fringes of using “new shiny language” and would be more likely to us “new shiny front-end framework” in new projects.

I really like Elixir, a lot. I’ve had Erlang experience and I’ve never understood the hate around it’s syntax. Elixir is definitely more friendly in that regard and I’m glad it’s bringing the tremendous value of the BEAM and OTP to more mainstream development circles.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by kiliancs on Monday March 05, 2018 @10:02AM (#16521456)
From a strictly technical perspective (that is, excluding otherwise important factors like hiring) Elm is one of the best solutions for web UI development. The language is small (compared to Haskell for example), it pretty much enforces a sane approach to state management and componentalization, frees you from a whole class of JavaScript bugs including runtime exceptions and is very fast. The fact that it's functional just makes it more attractive to developers that are already confortable with or committed to functional languages such as Elixir.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by lilactown on Monday March 05, 2018 @09:04AM (#16521074)
I think it's a novel inversion of the status quo, where statically typed languages live on the server and dynamic languages live on the client.

I think that Elm and Elixir fit their respective development niches (UI, distributed systems) extremely well, both have similar community cultures, and both started gaining some traction at around the same time.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by true_religion on Monday March 05, 2018 @09:18AM (#16521166)
I think Elixir is a wonderfully expressive language built on a strong foundation in the ErlangVM. It inherits Erlang's semantics which I've always liked.

Elm on the other hand inherits Javascript as its foundation, and the browser as its target. Javascript has an anemic standard library, and isn't a functional strongly typed language to begin with. Now since the browser is the target, file size is important, preventing Elm from simply shipping its own runtime + standard library.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by pseudonom- on Monday March 05, 2018 @11:51AM (#16522336)
Are you confused or am I confused? Elm does ship it's own runtime and standard library. Or at least it used to.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by true_religion on Monday March 05, 2018 @01:57PM (#16523380)
Whoops, I must be confused. I thought Elm compiled to Javascript, and didn't implement a custom runtime.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by lilactown on Monday March 05, 2018 @05:07PM (#16524935)
Elm does compile to JavaScript, but does come with it's own runtime on top of it and standard library.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by ehsanu1 on Monday March 05, 2018 @12:43PM (#16522784)
Yeah, true_religion seems confused/misinformed.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by rdtsc on Monday March 05, 2018 @10:26AM (#16521608)
> The two languages have nothing in common beyond both being functional,

That's good enough for most people. From experience switching quickly between the two paradigms takes a bit longer than staying with the same one. That is once think about reducers, closures, immutable data it's easier to stay in that mindset then going back to mutable objects and attributes.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by macintux on Monday March 05, 2018 @11:34AM (#16522174)
Have spent a lot of time doing Python after a few years in Erlang, and I've wasted a lot of time chasing down stupid mistakes because I still tend to think immutability when it isn't warranted.

I love useful constraints.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by rdtsc on Monday March 05, 2018 @01:32PM (#16523158)
I am using both, and I find that at least in Python I started using more functions and passing the state around. A nice side-effect is that also makes that code more testable as there is less need for mocks (since functions are more pure), but it's also more verbose and people think I am crazy now.

Though also Python in a sense already has some extra state visibility by passing self around in member function as opposed to hiding in an implicit this.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by macintux on Monday March 05, 2018 @02:49PM (#16523798)
Yeah, I implemented a state loop since my process is relatively short-lived. I'm sure anyone who knows Python would hate my code, and I'm not particularly proud of that: I simply don't know the usual idioms.

I was excited when I discovered accidentally that tuple unpacking in function heads was supported in Python, then depressed when I discovered that was dropped in Python 3, "because no one uses it". Sigh.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by somlor on Monday March 05, 2018 @11:24AM (#16522073)
As an Elixir dev I tend to agree. I've found ClojureScript to be a nicer fit (Reagent with re-frame if needed).
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by vim_wannabe on Monday March 05, 2018 @09:14AM (#16521137)
What are some relatively popular alternatives (that are not on the JVM)? Maybe the options are somewhat limited here if you want both to be functional.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by alkonaut on Monday March 05, 2018 @10:49AM (#16521801)
The Suave-Fable-Elmish stack (Made popular under the "SAFE-stack" name) is very nice. https://safe-stack.github.io/

It has the drawback of the frontend language not being as tiny as Elm is, but it has the benefit (which I think is no little benefit) of having the same statically typed language (F#) on both front and back end.

Whether it's "Relatively popular" is hard to say. It's tiny as far as web stacks popularity goes, but in completely functional web stacks it probably has taken a bite already.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by loop0 on Monday March 05, 2018 @09:52AM (#16521381)
Why not JVM? I'm asking because I'm starting to learn functional and I think Clojure is a very nice language to write both backend and frontend.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by macintux on Monday March 05, 2018 @10:04AM (#16521467)
The JVM is a great kitchen sink environment. The BEAM and Erlang/Elixir are much more finely tuned for their strengths: distributed systems, fault tolerance, immutable data/functional programming.

If you need raw performance, the JVM is definitely better. If you don't want to have to deal with the inherent tension between a FP language and mutable surroundings, the BEAM is worth a look.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by orestis on Monday March 05, 2018 @12:01PM (#16522411)
I'm exploring ClojureScript on both client (browser) and server (node).

Or perhaps, some day, https://github.com/clojerl/clojerl.

Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by eggy on Monday March 05, 2018 @12:52PM (#16522857)
And there's also LFE (Lisp Flavoured Erlang)[1] if you prefer Lisp to Lua.

  [1] http://lfe.io/
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by karmajunkie on Monday March 05, 2018 @09:36AM (#16521278)
I'm not an elm developer, but i think its closest analogue is probably Reason or bucklescript-tea, neither of which is jvm-based.
Re:Elm, Elixir, and Phoenix: Reflecting on a Functional Full... by leshow on Monday March 05, 2018 @10:36AM (#16521677)
Purescript is lots of fun to use and has a helpful community.