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
Consider moving RuntimeHelper.GetSubArray to Array #29218
Comments
@davidwrighton as well as he chose the current location (guessing with some reason). |
Honestly, I don't care. I'd keep it where it is, since that's the easiest solution. |
Regardless of where it lives, what about the |
Slightly easier for the compiler if it's kept as range since we don't have to emit more code, but it doesn't really matter. I suppose we could do the same optimization for an inline range, but it just doesn't seem to matter vs allocation + copy. |
Its in the current location, as when initially designed it was only going to be called from compiler generated code, and had no particular reason to be on System.Array. If its expected to be used by normal developers directly, then placing it on System.Array is perfectly reasonable. (In addition, the api wasn't quite like the other Slice methods as the method wasn't on the exact type, it could only have been placed on System.Array, not on the actual array types.) I have no objection to moving it to System.Array, if it is to become like other methods. |
@dotnet/fxdc: anyone with strong opinions? We're running out of time and it seems neither of us feels super strongly. So my preference would be to leave it on |
Since we don't feel super strongly and the compiler would need to change, we're leaving it where it is. |
@terrajobst I'm trying to get as many as possible features from C# 8 working on .NET Framework 4.8. One of the obstacles is that I need to provide method
From this perspective, wouldn't it make sense to reconsider the decision about leaving the method in RuntimeHelpers? |
We don't have plans to support C# 8 features on .NET Framework, so we didn't design the features with this constraint in mind. At this point, it's like way too late to change the compiler to accommodate this. |
This came up as part of #28939.
Following the a range indexer binds to a method named
Slice
, we should also changeGetSubArray()
and put it onArray
. It's a bit weird that it's not an instance member, but we can't make it an extension method onArray
as the type isn't static. However, it still seems consistent as most array related methods are static.@agocke @dotnet/ldm, any thoughts on this?
The text was updated successfully, but these errors were encountered: