On Monday, 11 June 2018 at 10:07:39 UTC, Walter Bright wrote:

We have no design for this function that doesn't rely on the GC, and the GC needs TypeInfo. This function is not usable with betterC with or without the TypeInfo argument.

I understand that. I was using `_d_arraysetlengthT` as an example of problems I encountered trying to convert these runtime hooks into templates, specifically illustrating how the compiler does not enforce the guarantees of safety, nothrow, and pure, and, in fact, completely disregards them.

Converting *any* runtime hook, not just `_d_arraysetlengthT`, to a template comes with a whole host of problems because of the aforementioned issue. As soon as it's implemented as a template it is semantically analyzed in the context of its caller, so @safe, nothrow, pure, etc. all need to accommodated for. That's good to have the compiler check for that stuff. It's unfortunate the current implementation does not, and that's the fault in the current implementation.

There are other runtime hooks that are good candidates for templates, even if `_d_arraysetlengthT` isn't one of them. Again, I just chose `_d_arraysetlengthT` as an example, because it is the one I had experience with.

Mike

Reply via email to