How do these guards work in elixir_quote.erl?

Hi all,

I like to study Elixir’s source and I don’t know a lot of Erlang.

I got curious about these function declarations as I could not understand how a call to this function would match some guards.

We have in line 137:

dot(Meta, Left, Right, nil) when is_atom(Right) ->

then the next declaration in line 145:

dot(Meta, Left, {Right, _, Context}, nil) when is_atom(Right), is_atom(Context) ->

how does it work that the one in line 145 is ever reached? Same for the one in line 148.

Cheers!

Source here:

{Right, _, Context} is not an atom but a tuple, therefore is_atom/1 returns false.

2 Likes

Ah ok! Thanks NobbZ!