D perfomance

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Apr 26 11:05:11 UTC 2020


On Saturday, 25 April 2020 at 15:21:03 UTC, Jonathan M Davis 
wrote:
> You could probably do that, but I'm not sure that it could be 
> considered @safe.

I think it would be OK to have it as a non- at safe tool.  But ...

> It would probably make more sense to just use a custom array 
> type if that's what you really needed, though of course, that 
> causes its own set of difficulties (including having to 
> duplicate the array appending logic).

... I think that could possibly make more sense.  One thing that 
I really don't like about the original idea of an 
`alwaysAssumeSafeAppend(x)` is that it makes behaviour dependent 
on the instance rather than the type.  It would probably be 
better to have a clear type-based separation.

OTOH in my experience custom types are often finnicky in terms of 
how they interact with functions that expect a slice as input.  
So there could be a convenience in having it as an option for 
regular dynamic arrays.  Or it could just be that the custom type 
would need a bit more work in its implementation :-)


More information about the Digitalmars-d mailing list