effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Expand namespacing with additional features

Open b-studios opened this issue 1 year ago • 1 comments

PR #388 implements basic namespacing. In the future it would be great to have support for additional features. In particular,

  • [ ] control exporting selectively using visibility modifiers. Technically this could be implemented by annotating bindings with the modifier
    case class Bindings[F[_]](
      terms: Map[String, Set[F[TermSymbol]]], // terms can be overloaded
      types: Map[String, F[TypeSymbol]],
      captures: Map[String, F[Capture]],
      namespaces: Map[String, Bindings[F]]
    )
    
    enum Visibility[T] {
      case Public(binding: T)
      case Private(binding: T)
    
      def binding: T
    }
    
  • [ ] separate include (that is,include "foo/bar.effekt" as bar) and import and
  • [ ] allow more fine-grained imports, i.e., import foo::bar::{ x, y }, renaming imports etc.
  • [ ] add export foo for reexporting, again potentially with renaming
  • [ ] add a full project mode where all (specified) files are always processed so includes are not necessary. Such a project mode could also configure other flags to the Effekt compiler, as well as declare dependencies etc.

Look at https://gist.github.com/jiribenes/8195243f56a454d3465b06f02e8bb5a2?permalink_comment_id=4872857#gistcomment-4872857 for discussions on designs.

b-studios avatar Feb 05 '24 17:02 b-studios

Related to https://github.com/effekt-lang/effekt/issues/426

jiribenes avatar Mar 22 '24 16:03 jiribenes