Said case would not warn. I think we should warn only if you are defining
an alias, and it already exists, and it points to the same module.

Elixir also knows if an alias was defined by a macro, so we can skip the
warning in such cases too.

On Fri, Feb 4, 2022 at 9:57 AM Aleksei Matiushkin <
aleksei.matiush...@kantox.com> wrote:

> Another issue with an alias would be with many different aliases of the
> same module. E. g. in Ecto if the schema has two distinct associations with
> the same foreign schema, one might want to improve code readability by
>
> alias User, as: Customer # for customer-aware queries
> alias User, as: Seller # for seller-aware queries
>
>
>
> On Fri, Feb 4, 2022 at 8:49 AM Jon Rowe <m...@jonrowe.co.uk> wrote:
>
>> One of the same problems with `import` applies to `alias` too though, if
>> a library has `alias Module` in its `use` macro it would cause this warning
>> if you aliased it yourself to be explicit. Prehaps this is more suited to a
>> static analysis tool like credo which already warns you if your aliases and
>> import declarations are out of order, it could warn you if you have them
>> twice in the same file without hassling those who just like to be explicit
>> in files.
>>
>> Just my 2¢
>>
>> Cheers
>> Jon
>>
>> On Thu, 3 Feb 2022, at 10:57 PM, ku...@goyman.com wrote:
>>
>> Yeah I agree that import is more tricky. But for me, alias is the main
>> use case. I'll see if I can manage a PR.
>>
>> On Thursday, February 3, 2022 at 11:56:02 PM UTC+1 José Valim wrote:
>>
>> We can warn it for aliases no problems and a PR would be welcome.
>>
>> However, for imports it is a bit more complicated because you can import
>> something multiple times with different parts. Furthermore, maybe a library
>> Bar is doing "import Foo" and you want to repeat "import Foo" for clarity.
>> I think we will have false positives.
>>
>>
>> On Thu, Feb 3, 2022 at 9:48 PM ku...@goyman.com <ku...@goyman.com> wrote:
>>
>> If a module is aliased or imported multipled times by the module, it
>> would be handy to have a warning.
>>
>> For example:
>>
>> defmodule Foo do
>>
>>   alias Ecto.Changeset
>>   alias Ecto.Changeset
>>
>> end
>>
>> should result in a warning "duplicate import".
>>
>> This is low priority, but as there is one for unused import/alias it
>> would help make the code cleaner.
>>
>>
>> --
>> 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-co...@googlegroups.com.
>> To view this discussion on the web visit
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_elixir-2Dlang-2Dcore_0d85ffa7-2D3997-2D4637-2D915e-2D523a744d155cn-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=rmhwzhuTk1LyLPLZIrqkat6wS6r2qE3XZKnTTHGaxH8&m=nBaHIf39tjAxJ4vPfe7WXAQ-aEsO8kYQmVsnCiTnLKo&s=aSHkguMzbGx-iiTui5UCHrJWhHEyl-Ep6igt1UZBe38&e=>
>> https://groups.google.com/d/msgid/elixir-lang-core/0d85ffa7-3997-4637-915e-523a744d155cn%40googlegroups.com
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_elixir-2Dlang-2Dcore_0d85ffa7-2D3997-2D4637-2D915e-2D523a744d155cn-2540googlegroups.com&d=DwQFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=rmhwzhuTk1LyLPLZIrqkat6wS6r2qE3XZKnTTHGaxH8&m=nBaHIf39tjAxJ4vPfe7WXAQ-aEsO8kYQmVsnCiTnLKo&s=QvMK3TW4FZbMn7hVivBq4OEQ_lIHVZB6OnwwfTRPE9Y&e=>
>> .
>>
>>
>> --
>> 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://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_elixir-2Dlang-2Dcore_cd5b5442-2D2f9f-2D44ea-2Dbaec-2D5c5a369ff8e0n-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=rmhwzhuTk1LyLPLZIrqkat6wS6r2qE3XZKnTTHGaxH8&m=nBaHIf39tjAxJ4vPfe7WXAQ-aEsO8kYQmVsnCiTnLKo&s=vHYcxlAYO9RJPBPFpDe6MtCDoC5v_bgaX7iCM9KlJcc&e=>
>> https://groups.google.com/d/msgid/elixir-lang-core/cd5b5442-2f9f-44ea-baec-5c5a369ff8e0n%40googlegroups.com
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_elixir-2Dlang-2Dcore_cd5b5442-2D2f9f-2D44ea-2Dbaec-2D5c5a369ff8e0n-2540googlegroups.com&d=DwQFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=rmhwzhuTk1LyLPLZIrqkat6wS6r2qE3XZKnTTHGaxH8&m=nBaHIf39tjAxJ4vPfe7WXAQ-aEsO8kYQmVsnCiTnLKo&s=qIDlwojMJ8gayZDa9PA38rJmLoVvikRZOaDTPJOby2o&e=>
>> .
>>
>>
>> --
>> 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://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_elixir-2Dlang-2Dcore_47b20449-2D8cfc-2D40f6-2D8106-2D5a07d30eabce-2540www.fastmail.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=rmhwzhuTk1LyLPLZIrqkat6wS6r2qE3XZKnTTHGaxH8&m=nBaHIf39tjAxJ4vPfe7WXAQ-aEsO8kYQmVsnCiTnLKo&s=Q6B8dyF6-dJfaRuAsRLAQLpiK0jY6UuVhcp-azl49sE&e=>
>> https://groups.google.com/d/msgid/elixir-lang-core/47b20449-8cfc-40f6-8106-5a07d30eabce%40www.fastmail.com
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_elixir-2Dlang-2Dcore_47b20449-2D8cfc-2D40f6-2D8106-2D5a07d30eabce-2540www.fastmail.com&d=DwQFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=rmhwzhuTk1LyLPLZIrqkat6wS6r2qE3XZKnTTHGaxH8&m=nBaHIf39tjAxJ4vPfe7WXAQ-aEsO8kYQmVsnCiTnLKo&s=GBpXOsjCgudIhDKy-rxwRRo2UaOQcGAt-7z4GQAL9zY&e=>
>> .
>>
>
>
> --
> *Aleksei Matiushkin*, Software Engineer - R&D
>
> Office (+34) 935 679 834
>
>
>
> 8 Devonshire Square, London, EC2M 4PL, United Kingdom
> Torre Mapfre, Planta 22, Marina, 16-18, 08005 Barcelona, Spain
> *kantox.com <http://kantox.com/>*
>
>
>
>
>
>
>
>
>
>
> <http://www.linkedin.com/company/1871617>
> <http://www.linkedin.com/company/1871617>[image: LinkedIn]
> <https://www.linkedin.com/company/1871617>
> <https://twitter.com/kantox>[image: Twitter] <https://twitter.com/kantox>
>    <http://www.youtube.com/user/kantoxfx>[image: YouTube]
> <https://www.youtube.com/user/kantoxfx>
>
> Kantox Limited is a UK private company with registered company number
> 07657495 and registered address at 8 Devonshire Square, London EC2M 4PL,
> United Kingdom. We are authorised with the UK Financial Conduct Authority
> (FCA) under the Payment Service Regulation 2017 as a Payments Institution
> (FRN 580343) for the provision of payment services and with HMRC as a Money
> Service Business Registration No.12641987.
> Kantox European Union, S.L.  is a Spanish private company with tax ID
> number B67369371 and registered address at Torre Mapfre, Planta 22, Marina,
> 16-18, 08005 Barcelona, Spain. Kantox is authorized by the Bank of Spain,
> with registration number 6890, which is the supervisor of the Spanish
> banking system along with the European Central Bank. Additionally, we are
> supervised by SEPBLAC, the Supervisory Authority for the prevention of
> money laundering and terrorist financing in Spain.
> KANTOX is the Controller for the processing of data in accordance with the
> GDPR and LOPDGDD for the purpose of maintaining a commercial relationship.
> You may exercise your rights of access and rectification, portability,
> restriction and opposition by writing to KANTOX to the email:
> g...@kantox.com. You have your right to make a complaint at www.aepd.es.
>
> --
> 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/CAGF5_6dWJ13eRDvr%3DbGSmK0rKbz1y%3DkLxpD2YvHiwRLD61uDHA%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGF5_6dWJ13eRDvr%3DbGSmK0rKbz1y%3DkLxpD2YvHiwRLD61uDHA%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 elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LpOkbNUAm71u_ckfWk_rabfVhhfN066Pr18wD0sCDJWw%40mail.gmail.com.

Reply via email to