<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 21 August 2015 at 13:35, Steven Schveighoffer via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8/21/15 7:22 AM, Iain Buclaw via Digitalmars-d wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Where removing RTTI disables D feature's in a compromising way, I'd<br>
start by questioning the why.<br>
<br>
Eg: Why does array literals need RTTI? Looking at _d_arrayliteralTX<br>
implementation, it only does the following with the given TypeInfo provided:<br>
<br>
- Get the array element size (this is known at compile time)<br>
- Get the array element type flags (calculated during the codegen stage,<br>
but otherwise known at compile time)<br>
- Test if the TypeInfo is derived from TypeInfo_Shared (can be done at -<br>
you guessed it - compile time by peeking through the baseClass linked<br>
list for a given TypeInfo type we are passing).<br>
<br>
So we have this function that accepts a TypeInfo, but doesn't really<br>
*need* to at all.<br>
<br>
void* _d_arrayliteralTX(size_t length, size_t sizeelem, uint flags, bool<br>
isshared);<br>
<br>
Just putting it out there....<br>
</blockquote>
<br></span>
I strongly suggest we *don't* go this route. This means that any changes to what is required for the runtime to properly construct an array requires a compiler change.<br>
<br>
A MUCH better solution:<br>
<br>
T[] _d_arrayliteral(T)(size_t length)<br>
<br>
Also, isn't the typeinfo now stored by the GC so it can call the dtor? Perhaps that is done in the filling of the array literal, but I would be surprised as this is a GC feature.<br><br></blockquote><div><br></div><div>I only looked at 2.066.1, the runtime implementation did not pass the typeinfo to the GC.<br></div><div> </div></div></div></div>