Keyboard shortcuts

/ or ⌘/Ctrl K
Find a note
j / k
Next / previous section or linked note
h / l
Collapse or go to parent / expand or enter
e or Alt-click
Read a linked note here
o
Open focused note on its own
g g / G
First / last section or linked note
g h / g a
Home / all notes
g b / g t
Backlinks / table of contents
t
Cycle System, Light, Dark
? / Esc
Show / close this reference

Search: ↑/↓ or Ctrl N/P, Enter to open. Shortcuts pause while typing.

elixir and erlang stacktraces [03977145]

drafts, elixir

Erlang and Elixir stacktraces eats the last frame because of super TCO optimizations

Reproduced able with

    defmodule Demo do
    def start do
      perform(__MODULE__, :target, [])
    end

    def perform(module, function, args) do
      {_, stacktrace} = Process.info(self(), :current_stacktrace)
      IO.inspect(stacktrace, label: "Stack trace in 'perform'")
      IO.inspect(self(), label: "PERFORM PID")
      apply(module, function, args)
    end

    def target do
      {_, stacktrace} = Process.info(self(), :current_stacktrace)
      IO.inspect(self(), label: "TARGET PID")
      IO.inspect(stacktrace, label: "Stack trace in 'target'")
    end
  end

  Demo.start()

file:2024-01-19_21-54-38_screenshot.png

If you apply on the last line it'll eat the stacktrace