Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
November 19, 2017 .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md Seems like D wisdom is creeping in. For instance, the Data Pipelines section basically explains why ranges/slices and algorithms are nice and relevant: <https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md#data-pipelines> |
November 18, 2017 Re: .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | On 11/18/2017 6:16 PM, Luís Marques wrote: > https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md > > Seems like D wisdom is creeping in. For instance, the Data Pipelines section basically explains why ranges/slices and algorithms are nice and relevant: <https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md#data-pipelines> It's on hackernews too. https://news.ycombinator.com/ |
November 19, 2017 Re: .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | On Sunday, 19 November 2017 at 02:16:36 UTC, Luís Marques wrote:
> https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md
>
> Seems like D wisdom is creeping in. For instance, the Data Pipelines section basically explains why ranges/slices and algorithms are nice and relevant: <https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md#data-pipelines>
Sorry to disappoint, but Span<T> is something else. The .net equivalent of D slices is in fact the not so popular ArraySegment<T> available in .net since 2008.
Span<T> will allow access to unmanaged and stack memory in the same way as using a standard array.
|
November 19, 2017 Re: .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rumbu | On Sunday, 19 November 2017 at 14:46:32 UTC, Rumbu wrote: > Sorry to disappoint, but Span<T> is something else. The .net equivalent of D slices is in fact the not so popular ArraySegment<T> available in .net since 2008. > > Span<T> will allow access to unmanaged and stack memory in the same way as using a standard array. Seems to be a C# version of C++ gsl::span: https://github.com/Microsoft/GSL/blob/master/include/gsl/span But yes, as I understand it, it will only allow shrinking the view, so it is a proper pointer-like type with sub-typing like behaviour. It might appear in C++20 as array_view eventually… not sure. |
November 21, 2017 Re: .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rumbu | On Sunday, 19 November 2017 at 14:46:32 UTC, Rumbu wrote:
> On Sunday, 19 November 2017 at 02:16:36 UTC, Luís Marques wrote:
>> https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md
>>
>> Seems like D wisdom is creeping in. For instance, the Data Pipelines section basically explains why ranges/slices and algorithms are nice and relevant: <https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md#data-pipelines>
>
> Sorry to disappoint, but Span<T> is something else. The .net equivalent of D slices is in fact the not so popular ArraySegment<T> available in .net since 2008.
>
> Span<T> will allow access to unmanaged and stack memory in the same way as using a standard array.
Actually Span<T> is a lot more like D slices in that it can use any type of memory.
ArraySegment<T> can only be initialized with an array type and thus is very far from being like a D slice.
I use D slices exclusively with non-GC memory or mapped files and similarly I can now make use of Span<T> but I was never able to employ ArraySegment<T>.
|
November 26, 2017 Re: .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to flamencofantasy | On Tuesday, 21 November 2017 at 19:39:19 UTC, flamencofantasy wrote:
> On Sunday, 19 November 2017 at 14:46:32 UTC, Rumbu wrote:
>> On Sunday, 19 November 2017 at 02:16:36 UTC, Luís Marques wrote:
>>> https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md
>>>
>>> Seems like D wisdom is creeping in. For instance, the Data Pipelines section basically explains why ranges/slices and algorithms are nice and relevant: <https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md#data-pipelines>
>>
>> Sorry to disappoint, but Span<T> is something else. The .net equivalent of D slices is in fact the not so popular ArraySegment<T> available in .net since 2008.
>>
>> Span<T> will allow access to unmanaged and stack memory in the same way as using a standard array.
>
> Actually Span<T> is a lot more like D slices in that it can use any type of memory.
> ArraySegment<T> can only be initialized with an array type and thus is very far from being like a D slice.
> I use D slices exclusively with non-GC memory or mapped files and similarly I can now make use of Span<T> but I was never able to employ ArraySegment<T>.
It's funny you say that because they just announced the introduction of ranges and I believe they return Spans.
|
November 26, 2017 Re: .NET introduces Span<T>, basically D slices | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guy | On Sunday, 26 November 2017 at 05:36:15 UTC, Guy wrote:
> It's funny you say that because they just announced the introduction of ranges and I believe they return Spans.
Well, basic dataflow pipelines with implicit transfer of buffer ownership. So it is a language feature with implicit RAII lifetime management, which is why Span is limited to the stack. Then they have a counterpart to Span called Memory that can be stored on th GC heap.
A reasonable tradeoff, but a general constraint would have been more interesting.
|
Copyright © 1999-2021 by the D Language Foundation