Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To consider: a module form #5

Open
3 tasks
kredati opened this issue Dec 14, 2023 · 1 comment
Open
3 tasks

To consider: a module form #5

kredati opened this issue Dec 14, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request next To do in a minute proposal A proposal to change the language semantics Language behaviour syntax Syntactic forms ux Related to user experience

Comments

@kredati
Copy link
Contributor

kredati commented Dec 14, 2023

A module form could be interesting. It describes a namespace, but instead of an explicit associative data structure (as the ns form is currently), it would be followed by a block. It would then bundle up all the bindings in this block into an equivalent namespace.

The following would then be equivalent:

& current `ns` strategy: 
let foo = ...
let bar = ...
let baz = ...
ns Foobar { foo, bar, baz }

& new `module` strategy:
module Foobar {
    let foo = ...
    let bar = ...
    let baz = ...
}

This is not quite pure sugar: it relies on the plumbing of Ludus being able to do something with the context of the scope. But I think this is quite ergonomic.

  • Is module the right name for this?
  • Is ns actually the name for this?
  • Is the old ns strategy the right one now that we don't have structs?
@kredati
Copy link
Contributor Author

kredati commented Dec 14, 2023

Better names? A current ns should actually be a package, pkg; the module proposal here is more properly called a "namespace."

@kredati kredati self-assigned this Dec 15, 2023
@kredati kredati added enhancement New feature or request ux Related to user experience syntax Syntactic forms semantics Language behaviour proposal A proposal to change the language next To do in a minute labels Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request next To do in a minute proposal A proposal to change the language semantics Language behaviour syntax Syntactic forms ux Related to user experience
Projects
None yet
Development

No branches or pull requests

1 participant