What's `v(-1)` in place of the omitted left side expression in an operator overload

I wonder if anyone can help me with this one.

Just for the sake of trying something out with my library, I went on to inspect the omitted left side expression in an operator overload function and I got v(-1). Are there any docs on this?

Ex:

defmacro left <~ right do
  IO.inspect( left)
  IO.inspect( Macro.to_string( left))

  # ..
end

then in iex:

iex(3)> <~ %{ b: 2}
# => {:v, [line: 3], [{:-, [line: 3], [1]}]}
# => "v(-1)"

So, what is the v(-1) and is it dependable (i.e. may I expect always to get it when omitting the left side expression for an operator mandating it?

Thanks

This is a behavior of the IEx read-eval-print loop to support multiline expressions, it won’t happen anywhere else. The v function here is IEx.Helpers.v/1.

5 Likes