-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[API Proposal]: Add CollectionsMarshal.AsMemory(List<T>)
#101914
Comments
Tagging subscribers to this area: @dotnet/area-system-collections |
That's not pay for play. It would make existing use of members like memory.Span more expensive. I don't think anything meaningful has changed since the last time this was discussed and rejected. |
How so? In this snippet, runtime/src/libraries/System.Private.CoreLib/src/System/Memory.cs Lines 293 to 309 in 71abc26
I think it would be a real shame if some new kind of resizable array was added, and it had no |
But okay, it seems there is no interest in this. I'll just keep using my own implementation of this. Thanks for entertaining the idea. |
I don't think that the goddess Fortuna has anything to do with this. Locking GitHub issues after a month of inactivity is a deliberate policy implemented by Microsoft. It didn't just occurred by accident. The reason that this policy exists continues to baffle me. As far as I can think, it only serves at depriving Microsoft from feedback about their products, from the knowledgeable engineers who use them. |
@theodorzoulias It's only here as far as I can tell, not Microsoft in general. I had been contributing to Roslyn quite a bit in the past, and they never had any policy like this (and they still do not). I was fixing issues no matter how old. |
I believe the bot locks closed issues and PRs after a month. Whereas open issues are only closed after 4-5 years of inactivity, and even then only after a notice saying that any comment will restart the clock for another several years. Locking closed issues is not done to avoid community comments. It is to direct them to open issues so that we actually see the comments. Before this we would often get comments on closed issues which we would not see, as practically we only monitor open issues. Often times those comments should have gone in a new issue anyway - for example the original problem was fixed, and they are experiencing the same symptoms for a different reason. I don't think this policy of locking closed issues is unique to this repo. If it really makes sense to reopen an issue rather than start a new one, what I suggest is asking for a maintainers to do that using the Discord channel or by creating a discussion topic here or possibly asking in a related issue. Does that help? This is not about suppressing comment. |
Background and motivation
I previously proposed this in #90141 and it was rejected for the reason that it would prevent
List<T>
's backing store from ever being changed from aT[]
to some new type of array, like some sort of resizable array. Or rather, it wouldn't prevent such a change, but it would require the returnedMemory<T>
to now be backed by aMemoryManager
, which is an additional allocation.@stephentoub said:
However, after thinking about this some more, I don't think this is the case. Unfortunately, I cannot add a comment to the original proposal, so I'm opening a new issue.
Memory<T>
can be backed by a GC object that stores the data inline in the object - currently (afaik), that's onlyT[]
andstring
. But if there is ever a new type of array added to the runtime, like a resizable array, thenMemory<T>
could just as well be backed by this new type of array - it would store a reference to this new array-like object. Or even ifList<T>
is ever specialized by the runtime and changed to store the data inline in the object, likestring
does, as opposed to going through an indirection, then theMemory<T>
could store the reference to theList<T>
itself. That's why I don't think returningMemory<T>
would bake in the notion of it being backed by aT[]
. It would only bake in the notion of it being backed by a GC object. Such a GC object could very well be a new kind of array, or even the list itself.Am I wrong in this conclusion?
The text was updated successfully, but these errors were encountered: