Modern Erlang Features

logger, try... catch C:R:Stacktrace, persistent_term socket module, counters/atomics

pg, erpc, docs in shell (h/1), numeric literal underscores, gen_server:send_request

JIT (BeamAsm), process aliases, EEP-54 extended error info, maps:merge_with, binary:encode_hex

maybe expression (experimental feature), lists:enumerate, lists:uniq, maps:groups_from_list, selectable features (-feature) map comprehensions, maybe enabled by default-ready, incremental Dialyzer, dynamic() type, faster maps

json module, triple-quoted strings, sigils (~"..."), -doc/-moduledoc attributes, maybe enabled by default, trace sessions, tprof priority messages, strict generators (<:-), zip generators (&&) in comprehensions, sets default to maps

39.1 The json module (OTP 27+)

json:encode(#{name => <<"Ann">>, tags => [<<"a">>, <<"b">>]}),   % iodata
iolist_to_binary(json:encode(#{a => 1})),                       % <<"{\"a\":1}">>
json:decode(<<"{\"a\": [1, 2, null]}">>),                       % #{<<"a">> => [1,2,null]}
json:format(#{a => 1}).                                         % pretty-printed iodata

39.2 Zip generators (OTP 28+)

[X + Y || X <- [1, 2, 3] && Y <- [10, 20, 30]].    % [11,22,33]

🧪 Part III Exercises

Implement a ring benchmark: N processes in a ring passing a message M times; measure time.

Write a chat room server with raw processes: join/leave/broadcast, monitoring clients.

Convert exercise 2 into a gen_server, with a supervisor restarting it.

Build a TCP chat server using gen_tcp with {active, once} and a simple_one_for_one supervisor of connection handlers.

Model a traffic light or vending machine with gen_statem, including state timeouts.

Implement a cache with TTL using ETS and a periodic cleanup process.

Set up two nodes and implement distributed ping-pong using global names; handle nodedown.

Store bank accounts in Mnesia with transactional transfers; replicate to a second node.

Write a port program in Python (or any language) using {packet, 4} framing and call it from Erlang.

Build a release with rebar3, perform a hot upgrade changing the state format via code_change/3.