
Core Erlang by Example - okket
http://blog.erlang.org/core-erlang-by-example/
======
jacquesm
Some background about Core Erlang:

[https://8thlight.com/blog/kofi-gumbs/2017/05/02/core-
erlang....](https://8thlight.com/blog/kofi-gumbs/2017/05/02/core-erlang.html)

Core Erlang is an intermediary language targeting 'BEAM', the Erlang virtual
machine.

~~~
jkingsbery
That reference helps the original link make a lot more sense.

I've spent about 2.5 years of my career writing Erlang code. It's statements
like "Core Erlang is less complicated than Erlang" that always trouble me
about the Erlang community - Core Erlang is less complicated _for compilers_ ,
not for humans. In this first in a series of blog posts about Core Erlang,
there is no context given around what it is or why anyone should care.

Erlang is a great language and environment, but it really struggles with the
marketing aspects of a platform, that is, how to make it accessible to humans.

~~~
djsumdog
I started playing around with Elixir a while back and find it really
fascinating as a language.

I've been a Scala dev for years and I gradually learned FP by moving from Java
to Scala, but in the case of Elixir, I've only barely looked at some Erlang
previously.

Would you say Elixir has done a better marketing job of being accessible to
developers?

~~~
ch4s3
I think it's not so much marketing as developer experience, and tooling. As a
sibling post mentions, Mix and Hex are amazing. Mix new is a very nice gateway
into a new project, giving you a fully working setup and even setting up the
basics of a supervision tree, if you want it. Beyond that, it makes some less
approachable aspects of OTP much simpler for a newcomer to use. Once you get
the basics, Genservers are very nice to work with.

~~~
klibertp
The stdlib is also a strong selling point of Elixir. Agent and Task modules
are a nice addition. AFAIK they have no equivalent in Erlang stdlib. It's
trivial to implement them on top of gen_server, but that's it - you need to
reimplement them every time, while in Elixir you have them available by
default. DynamicSupervisor is similarly a nice(r) interface to
simple_one_for_one supervisors.

In terms of language features, Elixir gives you (almost first-class) modules,
protocols, and macros. They are all implementable in Erlang, for example qlc
is a DSL implemented with parse transforms (which are macros), but Elixir
gives them to you nicely packaged and ready to use.

It can also become a problem. I love Lisps, and love proper macros, but every
other macro I see written by Elixir guys makes me cringe. Macros are a
powerful tool and it takes time and effort to learn not to abuse them. In
Lisps, even the younger ones, like Clojure, people only write macros if
there's really no other way to do something. In Elixir, people write them for
everything, they break hygiene habitually, and the language encourages that
(the `use` and `__using__` are the biggest offenders here, IMHO). It's a
trade-off between easy-to-write (in Elixir) and easy-to-read-and-debug (in
Erlang). Both approaches are valid, but for different use-cases.

------
enricosada
An example of Core Erlang usage:

\- fez ( [https://github.com/kjnilsson/fez](https://github.com/kjnilsson/fez)
) is an F# to Erlang compiler (compiling to Core Erlang)

A good intro with some word about core erlang too

[https://skillsmatter.com/skillscasts/11312-fez-fsharp-
type-s...](https://skillsmatter.com/skillscasts/11312-fez-fsharp-type-safety-
for-the-beam)

------
blackbrokkoli
Could someone ELI5 what I'm looking at?

~~~
macintux
See jacquesm's comment.

~~~
gkya
Which is this one:
[https://news.ycombinator.com/item?id=17012329](https://news.ycombinator.com/item?id=17012329)
jacquesm may comment more than once in the thread, no? :)

