My guard definition is coming up cannot invoke remote function

I have defined a guard in a definitions module and file.

  defguard is_maximum_tiles_in_rack(value)
           when is_integer(value) and
                  value >
                    @max_num_tiles_in_rack

I have aliased the GameDefinitions and attempt to use it in another module

 def take_tiles(bag, tiles, number_of_tiles)
      when GameDefinitions.is_maximum_tiles_in_rack(number_of_tiles),

but I get cannot invoke remote function…

I have tried following the example:

here Kernel — Elixir v1.19.4

I don’t think I have done anything wrong.

require GameDefinitions
2 Likes

And this is becuase the guard definition is actually a macro right?

  alias Scrabble.Engine.GameDefinitions
  require GameDefinitions

Correct. From the documentation for defguard:

Generates a macro suitable for use in guard expressions.

1 Like