News for hackers. Stuff that matters.
Re:Elixir RAM and the Template of Doom by true_religion on Thursday April 28, 2016 @02:55AM (#11586941)
> The form for `use` is different in Phoenix than it is in Elixir proper – instead of passing opts, you pass an atom that selects the implementation of __using__ you want.

This isn't really true. If you check out the ExUnit, you can pass something like "use ExUnit.Case, aysnc: true" and it'll setup your module to run tests asynchronously. You can pass any atom/value combination into use.

HTTPoision.Base, and ExAws to name a few other projects also have the convention of passing options into __using__.

To me, the confusion comes from the fact that the Elixir get-started documentation doesn't say anything about this. It is however listed in the Kernel forms that "use Module" actually just translates to Module.__using__([])

Re:Elixir RAM and the Template of Doom by phlakaton on Saturday April 30, 2016 @07:35PM (#11604136)
That's the point though - in those cases, you're passing a keyword list, a set of options, instead of an atom which acts as a selector. IIUC the Web module violates the convention attached to and documented for `use`, which to me, who was already wrangling with the subtleties of what `use` does compared to, say, Ruby's include, or Elixir's alias/import, was a bit of confusing (and relatively unconventional) magic.