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

Support type parameter syntax #677

Closed
evhub opened this issue Oct 25, 2022 · 6 comments
Closed

Support type parameter syntax #677

evhub opened this issue Oct 25, 2022 · 6 comments

Comments

@evhub
Copy link
Owner

evhub commented Oct 25, 2022

See PEP 695.

@evhub evhub added the feature label Oct 25, 2022
@evhub evhub added this to the v2.1.1 milestone Oct 25, 2022
evhub added a commit that referenced this issue Oct 26, 2022
@evhub
Copy link
Owner Author

evhub commented Oct 26, 2022

Basic type alias statements (type <name> = <type>) are now supported in coconut-develop. Rest of PEP 695 is still to be done.

@evhub
Copy link
Owner Author

evhub commented Oct 27, 2022

Biggest problem with the rest right now is that we'd need mypy to support infer_variance to implement this properly. Without that, we'll have to default to just making everything invariant.

@evhub
Copy link
Owner Author

evhub commented Oct 29, 2022

Other problem is scoping—not sure if there's any way we can get the right scoping and keep mypy happy.

@evhub
Copy link
Owner Author

evhub commented Oct 29, 2022

Only plausible way to get the right scoping is to use a temp var for the name, use a Wrap to create a context for the lexical scope, then replace all instances of matching names with the temp var.

evhub added a commit that referenced this issue Oct 29, 2022
evhub added a commit that referenced this issue Nov 1, 2022
evhub added a commit that referenced this issue Nov 1, 2022
@evhub
Copy link
Owner Author

evhub commented Nov 1, 2022

For bounds, we're going to support type NewType[T <= bound] = ... as an alternative to type NewType[T: bound] = ... that is more clear if you're used to thinking of : as "type of".

evhub added a commit that referenced this issue Nov 1, 2022
@evhub evhub added the resolved label Nov 1, 2022
@evhub
Copy link
Owner Author

evhub commented Nov 1, 2022

Aside from variance inference, this should now be fully supported on coconut-develop>=2.1.0-post_dev13.

@evhub evhub closed this as completed Nov 1, 2022
@evhub evhub mentioned this issue Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant