A warn: false option would solve it. But I believe last time libraries like
Plug used require to make sure a module is available. It has been quite a
while though.


*José Valimhttps://dashbit.co/ <https://dashbit.co/>*


On Sat, Sep 6, 2025 at 13:45 Jean Klingler <[email protected]> wrote:

> I think it would make sense, given that macros are the only documented
> reason to use require, and that Code.ensure_loaded (or
> Code.ensure_compiled!) should otherwise be used?
>
> We'd probably need to introduce a warn: false option like we have for
> import, for meta-programming use cases like __using__.
>
> Le ven. 5 sept. 2025 à 20:49, [email protected] <
> [email protected]> a écrit :
>
>> Hello all,
>>
>> I’d like to revisit this topic after some years. Back in 2019 there was
>> agreement that a warning for unused require could make sense, but more
>> investigation was needed because of its dual role (ensuring compilation +
>> enabling macros).
>>
>> Has the stance on this changed since then?
>> Would adding a warning when no macros are used from a required module be
>> considered today?
>>
>> Thanks!
>> Em terça-feira, 16 de abril de 2019 às 20:38:45 UTC-3, José Valim
>> escreveu:
>>
>>> I would keep the PR as it is the most clear explanation, especially for
>>> newcomers.
>>>
>>> If we do add the proposed warning in the future, users like OvermindDL1
>>> can use Code.ensure_compiled(module) to guarantee a certain module is
>>> compiled and available.
>>>
>>>
>>> *José Valim*
>>> www.plataformatec.com.br
>>> Skype: jv.ptec
>>> Founder and Director of R&D
>>>
>>>
>>> On Wed, Apr 17, 2019 at 1:34 AM Xavier Noria <[email protected]> wrote:
>>>
>>>> On Wed, 17 Apr 2019 at 02:06, OvermindDL1 <[email protected]> wrote:
>>>>
>>>> For note, I use `require` to compile another module that then generates
>>>>> 'other' things that are then used by the module that is calling require
>>>>> (calls another language build system), so it has non-macro uses.
>>>>>
>>>>
>>>> This is the PR that reworded that
>>>>
>>>>     https://github.com/elixir-lang/elixir/pull/6041
>>>>
>>>> Should it be revised?
>>>>
>>>>
>>>> --
>>>> Sent from Gmail Mobile
>>>>
>>>> --
>>>>
>>> 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 [email protected].
>>>>
>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/elixir-lang-core/CAM%3DYcdhet%3D3U73L0RBHQQUqTCw%3DfQuQkASQyTHfm4zEU9p90fw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/elixir-lang-core/CAM%3DYcdhet%3D3U73L0RBHQQUqTCw%3DfQuQkASQyTHfm4zEU9p90fw%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 [email protected].
>> To view this discussion visit
>> https://groups.google.com/d/msgid/elixir-lang-core/d7f98e5c-f28a-49b3-b2ae-9aa0d7266b09n%40googlegroups.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/d7f98e5c-f28a-49b3-b2ae-9aa0d7266b09n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/elixir-lang-core/CANnyoha-%2Bg%3DmUESo27rqCu4X%3DTOd%3DRTM5tqV-%2BXcMb%3DHBzrh%3DA%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CANnyoha-%2Bg%3DmUESo27rqCu4X%3DTOd%3DRTM5tqV-%2BXcMb%3DHBzrh%3DA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BfJ4jKNWvhzC7MiuUjUr6_5vpfeEuBs1%3DSAv3bo1Oxrw%40mail.gmail.com.

Reply via email to