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

Enforce that ValueTuple types are structs #11689

Closed
VSadov opened this issue Jun 1, 2016 · 6 comments · Fixed by #14161
Closed

Enforce that ValueTuple types are structs #11689

VSadov opened this issue Jun 1, 2016 · 6 comments · Fixed by #14161

Comments

@VSadov
Copy link
Member

VSadov commented Jun 1, 2016

We seem to be gradually taking some direct or indirect dependencies on tuples being structs already - we allow nullable conversions, may consider ctor invocations equivalent to element-wise assignments into a local with default value, etc...

There is no point in having special support for a case where ValueTuple are classes and it is more robust to just require tuple underlying types to be structs.

@jcouv
Copy link
Member

jcouv commented Aug 12, 2016

CC @AlekseyTs

@jcouv
Copy link
Member

jcouv commented Aug 18, 2016

@VSadov Could you provide more examples where such enforcement would be useful?
Aleksey thought this could be more trouble than it's worth (because it is a costly check to do early).
Maybe we leave this as-is?

@jcouv jcouv assigned VSadov and unassigned jcouv Aug 18, 2016
@AlekseyTs
Copy link
Contributor

Aleksey thought this could be more trouble than it's worth (because it is a costly check to do early).

Not only this is costly. It is also dangerous as it is likely to cause circularity during binding. I learned this the hard way while working on Non-nullable Reference Types. Checks whether a type is a value type should be postponed as much as possible.

@VSadov
Copy link
Member Author

VSadov commented Aug 19, 2016

I think we should try.
We can always leave it as-is.

@VSadov
Copy link
Member Author

VSadov commented Aug 19, 2016

It does not need to be a 100% comprehensive check.
The goal is to make it as obvious as possible that "reference ValueTuple" is not a supported scenario.

@AlekseyTs
Copy link
Contributor

I think we should do the opposite, i.e. don't assume that it is a struct, or verify this assumption only where implementation makes such assumption (ideally there should be no places like that). So, before we start trying something, we should review places where the assumption is made and evaluate how important/need that assumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment