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

off-by-one namespace layout #5539

Open
aryairani opened this issue Jan 14, 2025 · 1 comment
Open

off-by-one namespace layout #5539

aryairani opened this issue Jan 14, 2025 · 1 comment

Comments

@aryairani
Copy link
Contributor

aryairani commented Jan 14, 2025

Currently we have:

data Namespace = 
  Namespace {
    terms :: Relation NameSegment TermReference,
    types :: Relation NameSegment TypeReference,
    children :: Map NameSegment NamespaceHash
  }

This avoids unnamed definitions at the root, because all definitions need at least one NameSegment.

but we could have had

data Namespace =
  Namespace {
    terms :: Set TermReference,
    types :: Set TypeReference,
    children :: Map NameSegment NamespaceHash
  }

The latter simplifies some operations, such as finding, moving, or deleting all the definitions with a certain prefix.

We can link related issues to this ticket.

@aryairani
Copy link
Contributor Author

Maybe could get rid of the Split data structures outside command parsing/validation maybe, for making sure we don't get unnamed definitions at the top level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant