Cristian Vlasceanu and D for the .NET platform
Cristian Vlasceanu
cristian at zerobugs.org
Sat Mar 21 16:18:15 PDT 2009
Using ArraySegment's under the hood is kind of is what I am doing now; one
interesting edge case is when you want to call functions written in other
.NET languages (one main idea behind this project is to allow
interoperability between D and other languages, and leverage existing
frameworks rather than reinvent the wheel).
If you pass a slice to a "foreign" function that mutates elements in the
array, it will not work as expected, because non-D code has no knowledge of
slices.
The work-around is to construct a temporary array out of the slice, but any
changes that the called function makes to that temp array will be lost.
This can be remedied by having the compiler generate post-call code that
commits the changes back into the original array. It may work but is not
efficient.
Currently I content myself with just issuing a compiler warning / error when
such a situation is detected.
Cheers,
Cristian
"BCS" <ao at pathlink.com> wrote in message
news:78ccfa2d3bc0a8cb6ed48908f778 at news.digitalmars.com...
> Reply to Walter,
>
>> http://www.reddit.com/r/d_language/comments/838lf/cristian_vlasceanu_a
>> nd_d_for_the_net_platform/
>>
>
> His comments on array slicing are interesting.
>
> Seems to me the solution should be to have *all* dynamic arrays be
> ArraySegment as all dynamic arrays under DMD are a slices of the full
> memory space.
>
>
More information about the Digitalmars-d-announce
mailing list