Lukasz, it should be possible to warn on unused "require".
The thing is that "import" does what "require" does plus much more, and still the compiler warns on unused "import". Check this by playing with this code defmodule X do def foo, do: " hello" defmacro xpto, do: "Hey" end defmodule Y do import X #require X #def bar, do: X.xpto() <> X.foo() <> " world" end Regards Mário segunda-feira, 8 de Abril de 2019 às 09:45:28 UTC+1, Łukasz Niemier escreveu: > > You do not need to use macro to require compilation. You can use function > or even just depending on fact that this module is already compiled in some > highly hacky code with metaprogramming. I cannot give you any reasonable > example right now. Also remember that you can require something just to > call functions during compile time, it do not need to be macro. > > Wiadomość napisana przez Louis Pilfold <lo...@lpil.uk <javascript:>> w > dniu 08.04.2019, o godz. 10:39: > > Hey > > Wouldn't it be possible to track if any macros have been used by the > requiring module? I'm not familiar with the compiler here but it seems like > it is always possible as all information is available at compile time. > > Cheers, > Louis > > On Mon, 8 Apr 2019, 09:19 Łukasz Niemier, <luk...@niemier.pl <javascript:>> > wrote: > >> Not possible as `require`s are *always* used - by the compiler, as this >> marks that required module need to be compiled before compilation of module >> with require. >> >> W dniu piątek, 5 kwietnia 2019 17:48:56 UTC+2 użytkownik Mário Guimarães >> napisał: >>> >>> Hi, >>> >>> I suggest for Elixir to warn on unused requires, like it does for unused >>> aliases. >>> >>> Thanks >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-l...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/57e4a930-f4f2-4efa-a0bf-35f470a652a6%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/57e4a930-f4f2-4efa-a0bf-35f470a652a6%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 a topic in the > Google Groups "elixir-lang-core" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elixir-lang-core/d9ZjViQaOY8/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > elixir-l...@googlegroups.com <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CABu8xFBrM7LuJoZT0HzPQ-ifxOSgVZT03XwRu%3D-pC%3DQ%3D5Ow21Q%40mail.gmail.com > > <https://groups.google.com/d/msgid/elixir-lang-core/CABu8xFBrM7LuJoZT0HzPQ-ifxOSgVZT03XwRu%3D-pC%3DQ%3D5Ow21Q%40mail.gmail.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-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/130d4573-9194-4d91-be5b-c2ed909f2001%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.