A tiny macro to clean LiveView code

That;s pretty cool :wink: I’ll have to play with it a little bit to completely grasp it, thanks!

If any1 is actually using it, here’s an update. Using @tfwright & @ityonemo suggestions, I’ve got:

  defmacro sigil_a(expr, _modifiers) do
    {_, _, [key]} = expr
    key = String.to_atom(key)

    quote do
      Map.fetch!(var!(socket).assigns, unquote(key))
    end
  end

1 Like