[OT] Unity migrating parts of their engine from C++ into High Performace C# (HPC#)

Laeeth Isharc Laeeth at laeeth.com
Tue Apr 3 01:31:12 UTC 2018


On Monday, 2 April 2018 at 20:19:17 UTC, rumbu wrote:
> On Monday, 2 April 2018 at 18:54:28 UTC, 12345swordy wrote:
>>>
>>> - Only structs are used, no classes;
>>> - .NET collections are replaced by native collections that 
>>> manage their own memory
>>> - No code that would trigger GC is allowed
>>> - Compiler is aware of Unity features and is able to explore 
>>> SIMD, by doing auto-vectorization, and transparently 
>>> transform structs fields into optimal representations
>
>
> The struct type in C# is more versatile than the D's 
> equivalent, mainly because of the fact that you can inherit 
> interfaces. You can have template constraints in D but this is 
> not as user friendly as a struct interface.
>
> So in C# you can write code like this:
>
> interface IRange<T>
> {
>    void popFront();
>    bool empty();
>    T front();
> }
>
> struct MyRange<T>: IRange<T>
> {
>   //implementation
> }
>
> void foo<T>(IRange<T> someRange)
> {
>    //do something with someRange even it's a struct
>    //this includes code completion and other IDE specific stuff.
> }
>
>
> In D, template constrains are not very clean and they not have 
> IDE support:
>
> void foo(T)(T someRange) if (isInputRange!T)
> {
>
> }

You can do that in D too - see Atila's concepts library.




More information about the Digitalmars-d mailing list