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

Module self types #329

Merged
merged 2 commits into from
Jul 11, 2020
Merged

Module self types #329

merged 2 commits into from
Jul 11, 2020

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Jul 11, 2020

This PR is to update syntax to specify self type constraint on modules.

The current syntax allows arbitrary types to be there.

module M : _Each[Integer, String]       # This is okay
end

module N : _Each[Integer, String] | Integer     # What does this mean???
end

This patch introduces a new syntax construct to limit the types to be there.

module X : _Each[Integer, String], _ToInt, _ToStr
end

This allows making having multiple module declarations more natural. The following has two module declarations for X and the self type constraint means the same with the above.

module X : _Each[Integer, String], _ToInt
end

module X : _ToStr
end

@soutaro soutaro merged commit 0aac6d1 into master Jul 11, 2020
@soutaro soutaro deleted the module-self-types branch July 11, 2020 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant