On Tuesday, 3 April 2018 at 04:50:15 UTC, rumbu wrote:
On Monday, 2 April 2018 at 22:55:58 UTC, Meta wrote:
On Monday, 2 April 2018 at 20:19:17 UTC, rumbu wrote:


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)
{

}

Worth mentioning is that doing this necessarily causes the struct to be boxed. I would not be surprised if they ban structs inheriting from interfaces.

HPC# allows interface inheritance, but does not box structs. It's clearly stated in the video (15:30). In fact, boxing would bring up the GC, and GC is not allowed in HPC#.

Oh, that's really neat (was on mobile and could not watch the video).

Reply via email to