The use case for macros is for model-specific functions. You don't want the same matched functions applying to all models
On Saturday, July 16, 2016 at 1:44:11 AM UTC-4, Michał Muskała wrote: > > To be honest, I have a really hard time to understand why this library is > using macros at all. > All of this can be achieved with just functions, in a much clearer way > (although that’s obviously just my opinion). > Using functions also allows you to have multiple different builders, > should you need them, and completely decouples the query from the module. > > I’ve created a simple gist to showcase a possible, macro-less, solution: > https://gist.github.com/michalmuskala/ade699c25caccb51760a4c0c050b5707 > > Michał. > > On 16 Jul 2016, at 02:12, Brian Cardarella <[email protected] > <javascript:>> wrote: > > In one of my libraries this line throws a warning: > > > https://github.com/DockYard/inquisitor/blob/master/test/inquisitor_test.exs#L54 > > "unused import Ecto.Query" > > because the `use` module above will @before_compile the following: > > https://github.com/DockYard/inquisitor/blob/master/lib/inquisitor.ex#L83 > > so technically the Whitelist module has calls to Ecto.Query but for > whatever reason Elixir doesn't think so. > > Yes, this is a test case but I'm curious if there are ways to clean this > up? > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-talk/aa3b0d82-9a47-4296-ba64-47ca5f25271c%40googlegroups.com > > <https://groups.google.com/d/msgid/elixir-lang-talk/aa3b0d82-9a47-4296-ba64-47ca5f25271c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/911d9bfc-f93a-4fa3-a96b-337235a2e83e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
