News for hackers. Stuff that matters.
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by hestefisk on Sunday April 21, 2019 @07:57PM (#19715320)
Good read. Curious about Elixir. Why would one use this over ‘plain old’ Erlang / OTP apart from the Rubyesque syntax, which might appeal to RoR devs?
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by schneidmaster on Sunday April 21, 2019 @08:01PM (#19715338)
It's 100% the syntax. It appeals to ruby devs and also I think it's a lot easier to grok in general. But you can write Erlang code directly in an Elixir file, you can use Erlang libraries directly in Elixir, and Elixir compiles to the same BEAM instructions that Erlang does, so there's functionally no difference in terms of capabilities or what happens when they run.
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by SteveGregory on Sunday April 21, 2019 @08:18PM (#19715412)
This is not totally true. It’s not 100% syntax. Elixir has one additional and widely used feature: macros.

In Elixir, as in Lisp, you can transform your code as a data structure into new code. This is importantly used in Ecto, the de-facto object data mapper in Elixir. It’s also used in Absinthe, a library from the posted link for making GraphQL APIs.

Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by ramchip on Sunday April 21, 2019 @09:42PM (#19715763)
Protocols are also an important feature. `IO.inspect`, `Enum`, etc. are very nice additions.
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by elcritch on Sunday April 21, 2019 @09:59PM (#19715821)
In general the standard library organization is superb and well laid out. It’s the only language I don’t have to consistently lookup "how do I do X with string", or “Y with a list".
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by schneidmaster on Sunday April 21, 2019 @08:46PM (#19715528)
Yeah, this is fair. I was mentally lumping certain language features under "syntax" but that's not really accurate.
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by out_of_protocol on Monday April 22, 2019 @03:11PM (#19721845)
* consistent standard library (huge win IMO)

* efficient utf8 binary strings (which is actually conforms with utf8 standard), no mixup with charlists

* mix etc standard tooling

* macros

* enum stuff

* pipeline operator "|>", which by its mere existence enforces input/output param's consistency in user-written functions

etc

Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by qaq on Sunday April 21, 2019 @08:03PM (#19715346)
well better unicode support too
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by TylerE on Sunday April 21, 2019 @09:26PM (#19715701)
It's not just syntax. There are semantics differences.

A big one is that Elixir allows rebinding of a variable. Erland does not, which tends to lead to ugly names since in erlang you can't do common reassignment patterns like x = x * someConversionFactor.

Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by pdimitar on Monday April 22, 2019 @10:58AM (#19719401)
* Unified tooling (`mix`).

* Tests inside documentation.

* Macros.

* Protocols.

* `mix xref` has a family of sub-commands that gives you good code analysis (callers, callees etc.)

* First-class Unicode support. All strings are UTF-8 by default (you can fallback to ASCII if you need it; there are also good transcoding libraries in both Elixir and Erlang).

Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by jaytaylor on Sunday April 21, 2019 @08:03PM (#19715344)
Many folks seem to prefer Elixir to "Plain old Erlang" because for those who come from an imperative and / or object-oriented background, picking up Erlang means taking on a significantly steeper learning curve.
Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by nathan_long on Monday April 22, 2019 @09:23AM (#19718682)
Friendlier tooling and documentation are a couple of reasons.

Elixir's whole reason for existence is to make the Erlang programming model easier to use. Try it and see if it does.

Re:Elixir, Phoenix, Absinthe, GraphQL, React, and Apollo by AlchemistCamp on Monday April 22, 2019 @01:20AM (#19716708)
> Why would one use this over ‘plain old’ Erlang / OTP apart from the Rubyesque syntax

The two really big features are macros and protocols.