gren-lang / gren-lang/compiler

Enable user-defined namespacing for packages in gren.json

Open
#120 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language proposal
Dominant language
Haskell
Stars
503
Forks
29
PR merge metrics
No merged PRs in 30d

Description

From the module conflict resolution thread on Zulip:

To mitigate the problem of module name clashes between multiple dependencies, or between a dependency and a project's own source code, what if we could optionally define a namespace in gren.json for each imported package, e.g.:

"dependencies": {
    "direct": {
        "justinmimbs/date": {"version": "3.2.1", "namespace": "Internal"},
        ...

Then we could use import Date to import a local Date.gren module from our own project's src folder, while import Internal.Date would refer to the one from the justinmimbs/date package.

Another, possibly better, option is to allow imports in each file to specify the package they are imported from, something like:

import Date from justinmimbs/date
import Date from someoneelse/date as Date2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked module conflict resolution thread, then trace how gren.json dependencies and source-file imports are parsed and resolved. The proposal presents two alternative designs, so first establish which behavior is wanted; done should include a decided namespace or package-qualified import model with corresponding compiler coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.