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

tuple subscripts as overload, always generate TupAt for gear3 #346

Merged
merged 9 commits into from
Jan 10, 2025

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Jan 10, 2025

refs #269

Gear3 anonymizes the tuple fields according to their indexes, so TupAt is generated from tuple dot fields and converted back into a dot field in gear3, rather than the other way around. An alternative would be an alternative dot tag like (tdot tup.0 fld.0 +123) where the final integer is the offset but this may be excessive.

Since static params are not fully implemented, the index being a compile time value has to be enforced manually in the magic for now, and typed template/generic params cannot really be used as the index, only worked around here in []= by the fact that the tuple type is a typevar and so we don't have to fully semcheck it.

We could also implement this as builtin subscript behavior rather than an overload in the worst case.

@metagn metagn changed the title tuple subscripts, becomes dot but should be other way around tuple subscripts as overload, always generate TupAt for gear3 Jan 10, 2025
@metagn metagn marked this pull request as ready for review January 10, 2025 07:49
@Araq Araq merged commit 5213495 into nim-lang:master Jan 10, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants