kentaroi

kentaroi

Programming Elixir 1.6 - errata (page 227)

def puts(device \\ group_leader(), item) do
        erl_dev = map_dev(device)
        :io.put_chars erl_dev, [to_iodata(item), ?\n]
end

def puts(device \\ :stdio, item) do
        :io.put_chars(map_dev(device), [to_chardata(item), ?\n])
end


The implementation of IO.puts function in page 227 is outdated (elixir/lib/elixir/lib/io.ex at v1.6 · elixir-lang/elixir · GitHub).

The problem is the above code is the introduction of :erlang.group_leader function, which is used later in page 227, but the implementation of IO.puts in Elixir 1.4 and above does not use the :erlang.group_leader function (Use :stdio instead of group_leader() as default device by michalmuskala · Pull Request #5089 · elixir-lang/elixir · GitHub).

By the way,

  • :stdio - a shortcut for :standard_io, which maps to
    the current Process.group_leader/0 in Erlang

(IO — Elixir v1.16.0)

Therefore, although the default device of the IO.puts function has changed to :stdio, the erlang.group_leader() function is still called in Erlang’s io module and the behavior of the IO.puts function was not changed by Use :stdio instead of group_leader() as default device by michalmuskala · Pull Request #5089 · elixir-lang/elixir · GitHub.

Popular Prag Prog topics Top

telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=> (create-...
New
simonpeter
When I try the command to create a pair of migration files I get an error. user=> (create-migration "guestbook") Execution error (Ill...
New
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
New
hazardco
On page 78 the following code appears: <%= link_to ‘Destroy’, product, class: ‘hover:underline’, method: :delete, data: { confirm...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
PragmaticBookshelf
Author Spotlight Erin Dees @undees Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New

Latest in PragProg

View all threads ❯