D language and .NET platform

Chad J chadjoan at __spam.is.bad__gmail.com
Sun Jul 29 10:25:37 PDT 2012


On 07/29/2012 01:11 PM, Timon Gehr wrote:
> On 07/29/2012 07:00 PM, Timon Gehr wrote:
>> On 07/29/2012 06:32 PM, Alex Rønne Petersen wrote:
>>> On 29-07-2012 17:36, bearophile wrote:
>>>> Alex Rønne Petersen:
>>>>
>>>>> .NET is too limited to represent the language,
>>>>
>>>> Can you tell us why?
>>>>
>>>> Bye,
>>>> bearophile
>>>
>>> Array slices. The .NET type system has no way to represent them because
>>> it's designed for precise GC, and array slices allow interior pointers
>>> in the heap (as opposed to the stack when passing a field of an object
>>> by reference to a function, or whatever).
>>>
>>
>> I think all of CTFE-D should map to .NET without much hassle.
>>
>
> This could get a little hairy:
>
> struct S{
> int x,y;
> }
>
> void main(){
> S s;
> auto p = &s.y;
> // ...
> }
>
> It would have to be translated to something like (pseudo-code)
>
> class S{
> int x;
> int y;
>
> S copy(){...}
> }
>
> class SyPointer : Pointer<int> {
> private S instance;
> override int deref(){ return instance.y; }
> override void derefAssign(int y){ instance.y = y; }
> }
>
> Out of the window goes native value type support.

I still always thought it funny that we didn't reach for it anyways.  It 
seems like the VMs can weaken performance significantly, but they should 
always be able to implement D's semantics.  It's a matter of finding 
effective hacks.


More information about the Digitalmars-d mailing list