On Sat, Jun 19, 2010 at 5:01 PM, Tobias C Rittweiler <span dir="ltr"><<a href="mailto:tcr@freebits.de">tcr@freebits.de</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
In article<br>
<<a href="mailto:AANLkTikYgy1xjiEH9CfkEVsIEDg8ZvwjyYJ1-H-vti3N@mail.gmail.com">AANLkTikYgy1xjiEH9CfkEVsIEDg8ZvwjyYJ1-H-vti3N@mail.gmail.com</a>>,<br>
<div class="im"> Juan Jose Garcia-Ripoll<br>
<<a href="mailto:juanjose.garciaripoll@googlemail.com">juanjose.garciaripoll@googlemail.com</a>> wrote:<br>
<br>
</div><div class="im">> I am greatly amazed at the improvements in type propagation -- which still<br>
> can not be called liked that, but which does some minimal type inference --,<br>
> probably because the stupid algorithm catches quite many problems already.<br>
><br>
> However, precisely due to the simplicity of the current algorithms, one<br>
> thing that may be a showstopper is that there is code around that looks like<br>
> this<br>
> (when (stringp foo)<br>
> (replace foo faa ...))<br>
><br>
> I am a bit lost here. On the one hand this is valid Lisp, even if FOO is<br>
> inferred to have, say, an integer type. However the compiler will see that<br>
> REPLACE gets arguments of the wrong type and will complain.<br>
<br>
</div>I'm not following. What's wrong in the call to REPLACE?<br></blockquote><div><br>Sorry if I was not clear, but FOO was previously declared to have type INTEGER and that makes the code unreachable, but it also makes the call to REPLACE invalid. The problem is that we will not always be able to infer that the code is not reachable, for instance this inference done right now _after_ type propagation takes place. Furthermore, instead of STRINGP we could have another user defined function.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
The compiler can infer that FOO inside the branch must have type STRING.<br></blockquote><div><br>Doing this is not as easy as it sounds. Inferring types from conditional expressions and branches is not only difficult, but it may also be impossible when predicates are combined.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
My point is that the call to REPLACE is never questionable. The WHEN<br>
form may.<br clear="all"></blockquote></div><br>The call itself is questionable if it has arguments which were declared to have another type.<br><br>Juanjo<br><br>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br>
<a href="http://tream.dreamhosters.com">http://tream.dreamhosters.com</a><br>