effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Add qualified declarations

Open jiribenes opened this issue 1 month ago • 2 comments

Allow the following

def foo::bar(...) = <>

to stand for:

namespace foo { def bar(...) = <> }
export foo::bar // we can't write this yet in the surface language!

So that you can call bar with both foo::bar and "just" bar.

Later on, we could enforce this for overloaded terms (so that there's always at least one "distinguishing" call), such as int::show, string::show, ....


This might need some tweaks in Lexer & Parser, then "unwrap" in Namer, similarly to what https://github.com/effekt-lang/effekt/pull/1092 did:

          // define in namespace ...
          Context.namespace(interfaceId.name) {
            Context.define(id, opSym)
          }
          // ... and bind outside
          Context.bind(opSym)
          opSym

jiribenes avatar Nov 25 '25 18:11 jiribenes

Truth be told, I'm quite tempted to sneak in Koka-style foo/bar instead :)

jiribenes avatar Nov 25 '25 18:11 jiribenes

I would prefer if it was not available unqualified.

phischu avatar Nov 25 '25 19:11 phischu