<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/7/1 JS <span dir="ltr"><<a href="mailto:js.mdnq@gmail.com" target="_blank">js.mdnq@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">I am simply talking about having the compiler enlarge the type if needed. (this is mainly for built in types since the type hierarchy is explicitly known)<br></div></div>
</blockquote></div><br></div><div class="gmail_extra"><div class="gmail_extra">Just a simple matter, it would *drastically* increase compilation time.</div><div class="gmail_extra"><br></div><div class="gmail_extra">void foo()</div>
<div class="gmail_extra">{</div><div class="gmail_extra">    auto elem;</div><div class="gmail_extra">    auto arr = [elem];</div><div class="gmail_extra"><br></div><div class="gmail_extra">    elem = 1;</div><div class="gmail_extra">
    ....</div><div class="gmail_extra">    elem = 2.0;</div><div class="gmail_extra">    // typeof(elem) change should modify the result of typeof(arr)</div><div class="gmail_extra">}</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">Such type dependencies between multiple variables are common in the realistic program.</div><div class="gmail_extra"><br></div><div class="gmail_extra">When `elem = 2.0;` is found, compiler should run semantic analysis of the whole function body of foo _once again_, because the setting type of elem ignites the change of typeof(arr), and it would affect the code meaning.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">If another variable type would be modified, it also ignites the whole function body semantic again.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
After all, semantic analysis repetition would drastically increase.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I can easily imagine that the compilation cost would not be worth the small benefits.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Kenji Hara</div></div></div>