Live data from Hacker News

Elixir 1.9

elixir-lang.org

111–120 of 174 posts

Re: Elixir 1.9

#111

Earlier quoted context omitted.

I learned by converting a simple Rails API that I had running to do one or two things into a Phoenix API. In my case, it was very eye opening both because it was basic ETL and because it was something that benefited from high concurrency. I especially recommend this approach because it gives you more or less the most complete cross-section of some basic data structures, some web stuff, and some database stuff via the…

This is awesome, Cross-section is what I am also looking for. Appreciate the input, thank you!

Don't forget to learn how to write a GenServer from scratch. I lot of people I've met who hop straight into Phoenix forget to learn the basics of GenServers (and processes in general).

Here's a stupid example I whipped up:

https://gist.github.com/amorphid/3dec7028b05bd10f6ff3180d199...

^^^ you wouldn't ever code it that way, but you should (in my opinion) know what each line of code is trying to do.

Re: Elixir 1.9

#112
post #84
post #39

If anyone is on the fence on learning Elixir / Phoenix (Elixir's most popular web framework library) please do yourself a favor and give it a shot. If you're on a time crunch and want the best bang for your buck on "why bother learning yet another language to write web apps in?" then watch this talk called "The Soul of Erlang and Elixir": https://www.youtube.com/watch?v=JvBT4XBdoUE I'm not affiliated with the languag…

The thing is, nowadays, statically typed languages became so ergonomic, there is really no reason to go with dynamic languages.

Imagine typechecking a cluster of nodes all sending messages to each other.

Re: Elixir 1.9

#113

One part of releasing Elixir applications I never found a definite answer was how closely the build environment has to match the final environment where the release is deployed. The Erlang runtime is bundled with a release, and this part is platform-dependent as far as I understand. If I'm writing an application that I'll only deploy myself I can of course match the environments exactly. But what about if I wanted to…

Currently releases require the OS and architecture to match. However, Erlang/OTP does support cross compilation, so at least a possibility is there, it needs to be further explored: http://erlang.org/doc/installation_guide/INSTALL-CROSS.html The other concern is packages with NIFs (native code) and they would need to be changed if they don't support cross-compilation yet. I believe Nerves, which is an Elixir framewor…

How does `mix release` handle NIFs currently? Same architecture is assumed?

Re: Elixir 1.9

#114

I know nothing about Elixir/erlang besides following installs for apps. I have used it, installed via ASDF on my Raspberry pi since dependencies weren't up to date. Can anyone provide a good place to start on where to get started with Elixir? I tend to learn by working on stuff and not just reading etc, maybe a step by step in elixir? I am going into the literature now as well Thanks in advance for any help!

The How I Start guide was just updated for 1.9 http://howistart.org/posts/elixir/1/index.html

Excellent, I saw this researching today as well, I will check it out.

Thank you!

Re: Elixir 1.9

#115

Earlier quoted context omitted.

This is awesome, Cross-section is what I am also looking for. Appreciate the input, thank you!

Don't forget to learn how to write a GenServer from scratch. I lot of people I've met who hop straight into Phoenix forget to learn the basics of GenServers (and processes in general). Here's a stupid example I whipped up: https://gist.github.com/amorphid/3dec7028b05bd10f6ff3180d199... ^^^ you wouldn't ever code it that way, but you should (in my opinion) know what each line of code is trying to do.

This is great, I have been teaching myself everything and there are a lot of day 1 things I learned way too late, this is extremely valuable, thank you!

Re: Elixir 1.9

#116

I know nothing about Elixir/erlang besides following installs for apps. I have used it, installed via ASDF on my Raspberry pi since dependencies weren't up to date. Can anyone provide a good place to start on where to get started with Elixir? I tend to learn by working on stuff and not just reading etc, maybe a step by step in elixir? I am going into the literature now as well Thanks in advance for any help!

I read Dave Thomas' book cover-to-cover like some kind of legitimate nerd :) It was very good.

For understanding genservers there's The Little Elixir and OTP Guidebook, as well.

In my case I experimented with it for at least a year before I decided to jump in, my "experiments" are here: https://github.com/pmarreck/elixir-snippets (I tend to use single-file dev for exploring simple ideas; this is not a general pattern used in the community or anything, it's just something I discovered I could get by doing)

Re: Elixir 1.9

#117

As someone who's new to web dev, is there any incentives in going for Elixir than using those established languages(i.e. Node, Ruby)? Any book/sources recommendations?

This is anecdotal but I have inadvertently created FAR fewer bugs in Elixir/Phoenix than I ever did in Ruby/Rails. A lot of that has to do with the immutability guarantees and the pattern-matching and the fact that everything is explicit without being wordy... everything in this language seems designed to make it easy to grok what the code is doing, and that means fewer bugs produced.

Re: Elixir 1.9

#118

I'm still not a fan of tail regression, er, recursion.

I would perhaps agree that having to structure the code in such a way that TCO is "triggered" can be a hassle, but once you realize the pattern and learn it, it's not hard at all to refactor your code to trigger TCO. And it allows you to enjoy the semantics of an infinitely-deep stack without actually needing an infinitely-deep stack :)

Re: Elixir 1.9

#119

Earlier quoted context omitted.

The problem with hot code updates is they can break your app if your structs change shape and are extremely hard to get right over a period of time. Best to do rolling deployments with Kubenetes or something...

> The problem with hot code updates is they can break your app if your structs change shape I have no experience with Erlang/Elixir myself, so please excuse me if this is a silly question – but, why can't the language/platform actually detect the difference in struct shape, and refuse to deploy the new version in that case? Or, demand that you provide some sort of conversion function that maps the old struct to the n…

I have never actually used this feature but here goes:

The language standard library gives you hooks to relup the internal state of all of your processes: https://hexdocs.pm/elixir/GenServer.html#c:code_change/3

What it doesn't do is give you a hook to relup the messages that get passed between processes. If you do it right, you can pattern match against different versions of messages, and do the correct conversion function, but there are liable to be many, many, shapes of messages (including ones that you might not write yourself, e.g. coming from a library) and it might be difficult to catch them all.

To do it right, I would want to set up a lot of testing to make sure you can hot code reload safely. There is no specific guideline, and it probably hurts forward progress in developing guidelines, that generally, it's okay to have some downtime in any individual server node as erlang/elixir encourages you to think about failover anyways, and most elixir apps are relatively stateless webservers, so you've probably got robust load balancing and migration scheme in place in your cluster to begin with, making blue/green or rolling updates a "pretty much good enough" thing.

> Is this a consequence of lack of static typing

No.

Re: Elixir 1.9

#120

Earlier quoted context omitted.

Don't forget to learn how to write a GenServer from scratch. I lot of people I've met who hop straight into Phoenix forget to learn the basics of GenServers (and processes in general). Here's a stupid example I whipped up: https://gist.github.com/amorphid/3dec7028b05bd10f6ff3180d199... ^^^ you wouldn't ever code it that way, but you should (in my opinion) know what each line of code is trying to do.

This is great, I have been teaching myself everything and there are a lot of day 1 things I learned way too late, this is extremely valuable, thank you!

My pleasure, I'd you want another Elixir reference examples, feel free to email me. Email in profile.
Post reply on HN