Please help me understand this syntax quirk

Something to do with argument evaluation, but this really does seem counterintuitive:

pry(13)> n1
pry(14)> <<"1gej4", ?_>>
pry(15)> <<n1, ?_>>
** (ArgumentError) argument error
    (stdlib) :erl_eval.expr/3
    (iex) lib/iex/evaluator.ex:219: IEx.Evaluator.handle_eval/5
    (iex) lib/iex/evaluator.ex:200: IEx.Evaluator.do_eval/3
    (iex) lib/iex/evaluator.ex:178: IEx.Evaluator.eval/3
    (iex) lib/iex/evaluator.ex:77: IEx.Evaluator.loop/1
    (iex) lib/iex/evaluator.ex:21: IEx.Evaluator.init/4
    (iex) lib/iex/pry.ex:55: IEx.Pry.pry/2
1 Like

You haven’t specified size of n1. Make it <<n1 :: binary, ?_>> and it should do.


Ah, that’s it, I had no idea. Thanks.

1 Like