D language and .NET platform
Timon Gehr
timon.gehr at gmx.ch
Sun Jul 29 10:11:55 PDT 2012
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.
More information about the Digitalmars-d
mailing list