Tuesday, 15 February 2011

module - Elixir - What does the 'use' keyword do? -


I suspect that this is a primary question, but it is difficult to find a brief, canonical answer online.

At least I understand;

  • This is different from both 'requirement' and 'import'
  • It is used to import the contents of the module.
  • This is a macro

Can anyone explain?

This requirement s gave the module and then call codes to __ / 1 Allows callback to call so that the module can inject some code in the current context. See .

Example:

  Uses the defmodule test utility, Logic: Value termination  

is same as

  defmodule test requires utility utility. __ (argument :: value) end  

No comments:

Post a Comment