Stream: ideas

Topic: renaming while exposing


view this post on Zulip Richard Feldman (Dec 08 2023 at 15:04):

I just had a random idea that feels like it could address a longstanding pain point in a way that feels natural to me:

what if you could do this in module headers?

exposes [foo as bar]

The problem this would solve is when I want to expose something named foo because MyModule.foo is the best name for it, but also I happen to want to name things foo inside my module a lot

view this post on Zulip Richard Feldman (Dec 08 2023 at 15:05):

so this would let me name the top level function fooInternal or something, and then expose it with exposing [fooInternal as foo]

view this post on Zulip Richard Feldman (Dec 08 2023 at 15:06):

and then within the module I'd still be free to name things foo if I want to

view this post on Zulip Brendan Hansknecht (Dec 08 2023 at 16:07):

Happened to me with values when writing the new dict impl

view this post on Zulip Brendan Hansknecht (Dec 08 2023 at 16:07):

Cause there was already Dict.values

view this post on Zulip Brendan Hansknecht (Dec 08 2023 at 16:07):

So I'm for this change

view this post on Zulip Agus Zubiaga (Dec 08 2023 at 19:16):

Would this be allowed for imports too?

view this post on Zulip Richard Feldman (Dec 08 2023 at 20:38):

:thinking: I think it already is? Or at least should be haha, possibly not implemented

view this post on Zulip Agus Zubiaga (Dec 08 2023 at 21:45):

I meant at the exposed name level:

import Foo exposing [foo as bar]

view this post on Zulip Richard Feldman (Dec 08 2023 at 22:24):

oh gotcha, yeah we should definitely support that!


Last updated: Jun 16 2026 at 16:19 UTC