<br><br><div class="gmail_quote">On Fri, Apr 22, 2011 at 3:26 PM, Steve Schveighoffer <span dir="ltr"><<a href="mailto:schveiguy@yahoo.com">schveiguy@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Like it or not, the same thing applies to things like:<br>
<br>
writeln = "hello";<br>
<br>
Even though we know this is not the right way to call it, the compiler doesn't give an error to enforce the semantics.<br>
<font color="#888888"><br>
<br>
-Steve</font><br></blockquote></div><br>Ok, but just because you can do something utterly stupid like this doesn't mean you should. You can also do the following even though it's a terrible idea, because it's impossible for the compiler to reject every terrible idea without rejecting some good ideas:<br>
<br><span style="font-family: courier new,monospace;">import std.random;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">// Overwrite random memory locations with random data until the program</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">// crashes</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">void main() {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> while(true) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> auto num = uniform(0, int.max);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> auto ptr = cast(int*) num;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> *ptr = uniform(0, int.max);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><br>Again, I'd be more sympathetic to your point of view if making these changes didn't also break existing code. For me this is the tiebreaker. I have already designed a whole API around methods-as-properties. I'm sure having tons of code break will be very aggravating to a lot of people. Given the weak arguments put forth in favor of strict semantics, I can't bring myself to say that breaking not only existing code but whole existing API designs is justified.<br>
<br>BTW, as far as your argument about static typing, this may be a fundamental disagreement between us. I don't like static typing, but consider it a necessary evil in exchange for performance and the ability to do low-level work. Therefore, I want only as much static typing as is necessary for these to be possible.<br>