<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">From: Sjoerd Visscher &lt;<a href="mailto:sjoerd@w3future.com">sjoerd@w3future.com</a>&gt;<br>

<br>
On Nov 11, 2010, at 3:36 PM, Dan Doel wrote:<br>
<br>
&gt; On Thursday 11 November 2010 6:22:06 am Sjoerd Visscher wrote:<br>
&gt;<br>
&gt;&gt; The reasoning above is used regularly to shoot down some really useful<br>
&gt;&gt; functionality. So what would go wrong if we chose to take the practical<br>
&gt;&gt; path, and leave aside the theoretical issues?<br>
&gt;<br>
&gt; You would lose many uses of equational reasoning in your programs. Have you<br>
&gt; every substituted &#39;x * 2&#39; for the expression &#39;x + x&#39; in one of your programs,<br>
&gt; or vice versa? You can no longer do that, because someone may be serializing<br>
&gt; the function you&#39;re writing, checking how it&#39;s implemented, and relying it.<br>
<br>
<br>
Yes, but it would not break any existing code. It would only break code that knowingly did the wrong thing.<br>
<br>
&gt; We already have a weak case of this, since (\x -&gt; undefined x) can be<br>
&gt; distinguished from undefined using seq, but that can be hand-waved away by not<br>
&gt; worrying about bottoms so much. That isn&#39;t going to work for serialize.<br>
<br>
Why not?<br></blockquote><div><br></div><div>I don&#39;t know to what extent it would apply in this hypothetical situation, but ghc (and probably other compilers) rely upon Haskell&#39;s semantics in performing various code transformations.  If you break the semantics some transformations become invalid, resulting in incorrect code.</div>
<div><br></div><div>I&#39;ve experienced this with code that violated ref. transparency.  The program behavior changed depending on the compiler&#39;s optimization settings.  I&#39;m not keen to go back to that.</div><div>
<br></div><div>I think the only way this would work would be if you consider functions to be equal only to themselves, i.e. &quot;x+x&quot; and &quot;2*x&quot; are not equal.  That&#39;s not a trade-off I would be willing to make.</div>
<div><br></div><div>John</div></div>