racket / racket/rhombus

Make an RFC about modules, units, linklets, and linking

Open
#75 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
601
Forks
74
Avg merge
2d 10h
Merged PRs (30d)
5

Description

Racket1 has two user-facing methods of modularity: modules and units. Modules are purely compile-time things and always refer to their imports by name, so they are inherently not parameterized. Units are run-time things and support a lot of functionality and power via this nature, such as mutual recursion. Units are implemented purely as macros and work hard to be partially separably compilable (via, for example, macros only inside of unit signatures and not the units themselves.) At the VM level, Racket also supports linklets, which are like a limited kind of unit. Modules are implemented via compilation to sets of linklets.

I would like a modularity mechanism more similar to ML's module system where a module can be abstracted over its imports. I think it is valuable for thinking about programs and performance for this to be a compile-time decision, but I think it is interesting to think about whether the same specification mechanisms could be used for run-time and compile-time situations.

I think there are big risks for making the linking language too complicated to use for small things (which is what I perceive as a major issue with units) and forcing too much tooling outside of the program (which I perceive as a big issue in ML.) I think we can deal with the first by being less ambitious in terms of power and separate-compilability and I think the second is solved by a DSL that is like require/provide.

As a tiny concrete thing, I think it would be extremely useful for parameterized modules (functors in ML) to specify a default instance of their imports that is used when the module is run itself and when no linking specification is used.

I think this requires a connection to #9

Contributor guide

No contributing guide indexed for this repository

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 by reviewing the relationship to issue #9 and the existing modules, units, linklets, and linking concepts described here. Done means producing an RFC that evaluates parameterized modules, default imports, compile-time versus run-time use, and the trade-offs around simplicity and separate compilation.

Written by the indexing model from the issue text.

Assessment

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.