axelson

axelson

Scenic Core Team

4) Lonestar ElixirConf 2018 - Let's Talk Process Dictionary - Greg Vaughn

Let’s Talk Process Dictionary - @gregvaughn

Well, the first rule of Fight Club, I mean: process dictionary is that we don’t talk about process dictionary. That’s wise because people new to functional algorithms and immutable data structures may use it as a crutch, however, once we’re comfortable with that background, we should no longer be afraid of it. There’s legitimate reasons when to use it and when not to use it, which we’ll discuss in this talk.

Audience: Intermediate, Advanced

All talks thread: 0) Lonestar ElixirConf 2018 Talks

Most Liked

JEG2

JEG2

Author of Designing Elixir Systems with OTP

Of course this is right, of course, but I do feel like consciously dividing up pure and impure concerns in your Elixir programs is a powerful design tool. I have been hugely inspired by Gary Bernhardt’s Functional Core, Imperative Shell and @sasajuric’s To Spawn or not to Spawn.

We don’t get all the way to Elm’s side-effect free runtime, obviously, but knowing exactly where those lines our for your own code is a very powerful design strategy. I feel this is why you so heavily advocate—in the talk—for isolation of process dictionary code (preferably in one function).

I hear you though. Elixir’s not pure and it never will be. But I sure learned a ton about how to write Elixir code that I could manage by playing with pure languages.

AstonJ

AstonJ

Looks like a great talk Greg - and I love see references to things said on the forum :lol:

gregvaughn

gregvaughn

Thanks, @JEG2 ! I appreciate the accountability. Those who know me have seen some nits I have picked too :slight_smile: I did speak a bit “loosely” in some places.

Funny enough, during a follow-up slack conversation with the first person in Q&A (asking about :rand specifically) I dug in more and realized that yes, it does allow you to pass the seed explicitly. (Aside, I also learned: the older :random library also allows both explicit seed and process dictionary forms, but if you do not initially set the seed explicitly, it’ll set it to 0 so you can have repeatable randomness. “it’s a feature, not a bug”). So, in the bigger picture of Process Dictionary usage, this is a great example of having a pure way of using the library, but also allowing the convenience of the Process Dictionary too! Even better justification for using PD.

I absolutely agree with your I/O point. I was thinking more in terms of the entire system (including the runtime) but did not clarify that point. In any case Elixir is not pure, so the broader point stands.

I really appreciate the discussion, folks. I don’t often get to have this sort of feedback on a talk. Now I’m ready to come up with an improved v2 version of this talk. I think I’ll rename it “Mutants in the BEAM” :smiley:

gregvaughn

gregvaughn

@axelson Thanks! It was a lively Q&A, so I felt better about finishing a bit early.

In retrospect, ets was the proper solution for my CSV example. I wouldn’t have wanted to deal with an extra dependency for something so simple. To try to store a map locally would have meant realizing the stream (and pulling all data into memory) sooner with an Enum.reduce to have an accumulator for the lookup values.

Now for the real confession: that code is no longer used in production anyway :smile:

Where Next?

Popular in Talks Top

CodeSync
Introducing Phoenix Sync - James Arthur | ElixirConf EU 2025 | ElixirConf EU 2025 Comments welcome! View the <span class...
New
axelson
ElixirConf 2017 - Live APIs with GraphQL Subscriptions - @bruce and @benwilson512 APIs have gone live with G...
New
ElixirConf
ElixirConf: ElixirConf 2023 - German Velasco - Using DDD concepts to create better Phoenix Contexts Comments welcome! View the <span cla...
New
CodeSync
Code Sync: Writing much better tests in Elixir by Xochitl Pérez | Code BEAM Lite Mexico 2023 Comments welcome! View the <span class="has...
New
axelson
Hey folks, beginning to post today’s round of ElixirConf videos! ElixirConf US 2018 – Elixir at a Walking Pace – Lance Halvorsen (@lance...
New
New
axelson
ElixirConf 2017 - Building Realtime Mobile Apps with React Native and Elixir - Osayame Gaius Obaseki Buildin...
New
axelson
Consistent, Distributed Elixir - @keathley Elixir and Erlang provide powerful mechanisms for building systems that are alw...
New
CodeSync
Code Sync: Keynote: The Road To LiveView 1.0 by Chris McCord | ElixirConf EU 2023 Comments welcome! View the #code-sync and #elixirconf-...
New
TwistingTwists
I am in middle of watching this. I have to stop every minute and think over what Chris just said. The amount of info he sends over that ...
New

Other popular topics Top

Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement