<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx</link><description>When you're designing a new programming language, the "main line" cases are easy. It's the "corner" cases that bedevil language designers -- the little fiddly bits where two language features that make perfect sense on their own interact in some weird</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Method Hiding Apologia</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#9643552</link><pubDate>Wed, 27 May 2009 08:17:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9643552</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description>&lt;p&gt;Here's some back-and-forth from an email conversation I had with a user a while back. Why should one&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9643552" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#151557</link><pubDate>Wed, 09 Jun 2004 08:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151557</guid><dc:creator>Jeroen Frijters</dc:creator><description>&amp;gt;&amp;gt;Also, an empty cctor is not inefficient. The jitter will optimize it away.&amp;lt;&amp;lt;&lt;br&gt;&lt;br&gt;I didn't know that! Thanks for setting me straight and I apologise for the snide remark.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=151557" width="1" height="1"&gt;</description></item><item><title>A JScript .NET Design Donnybrook, Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#151213</link><pubDate>Wed, 09 Jun 2004 00:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151213</guid><dc:creator>Fabulous Adventures In Coding</dc:creator><description>&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=151213" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#151257</link><pubDate>Tue, 08 Jun 2004 21:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151257</guid><dc:creator>Eric Lippert</dc:creator><description>Also, an empty cctor is not inefficient.  The jitter will optimize it away.  &lt;br&gt;&lt;br&gt;I suspect that there really was no good reason to always generate the cctor even when it was empty -- perhaps it just worked out easier to write the codegen that way.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=151257" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#151237</link><pubDate>Tue, 08 Jun 2004 21:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:151237</guid><dc:creator>Peter Torr</dc:creator><description>Jeroen: I'm pretty sure that every type has a .cctor (even if it is empty) because it made the code generator much easier. When the compiler / runtime can both compile any valid program into IL *OR* dynamically interpret it, this becomes very important.&lt;br&gt;&lt;br&gt;Philip: The reason it checks for foo2 before foo3 is that we _assume_ (ha ha ha) that the developer of foo2.bar only knew about objects of type foo2 when [s]he wrote the code; they were not expecting someone else to come along, subclass their type, and add some other random method to it.&lt;br&gt;&lt;br&gt;If they expected this kind of tomfoolery, they would have used a type annotation (or so the thinking went).&lt;br&gt;&lt;br&gt;Basically performance of minimally-tweaked legacy JScript code was REALLY REALLY important for us in ASP .NET (who would upgrade if their pages were slower?) so trade offs like this were made.&lt;br&gt;&lt;br&gt;Interestingly, this chain of things-JScript-looks-for on a late bound call can get arbitrarily long, and it's *still* going to be faster than the latebound call in all reasonable cases. isinst is fast compared to InvokeMember ;-)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=151237" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#150700</link><pubDate>Tue, 08 Jun 2004 08:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150700</guid><dc:creator>Jeroen Frijters</dc:creator><description>Yuck. My mind just isn't capable of understanding scripting languages.&lt;br&gt;&lt;br&gt;BTW, why on earth does every type have a .cctor? I know script is supposed to be inefficient, but isn't this going over the top? ;-)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=150700" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#150634</link><pubDate>Tue, 08 Jun 2004 05:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150634</guid><dc:creator>Nicholas Allen</dc:creator><description>I stayed out of this one since I already knew the answer and mostly why it became that way.  But I enjoy the quirkyness.  Java also lives in this shadow world between the Static and Dynamic models.  You can write a very similar piece of code to this and get the same behavior.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=150634" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#150609</link><pubDate>Tue, 08 Jun 2004 05:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150609</guid><dc:creator>Centaur</dc:creator><description>I’m not much into JScript, and would expect 5. Because in the languages I have seen “hide” (by any other name, such as “reintroduce” in Delphi, “new” in C#) it breaks the override chain. The foo3::`get abc`() no longer overrides foo::`get abc`, and as such, will not be considered candidate for late binding.&lt;br&gt;&lt;br&gt;Of course, the “scripty” thing to do, in absence of knowledge about the type of f, would be to invoke abc by name, and that would probably resolve to foo3::`get abc`. In fact, one might try this:&lt;br&gt;&lt;br&gt;class baz { // totally unrelated to foo&lt;br&gt;   function get abc() {&lt;br&gt;     return 42;&lt;br&gt;   }&lt;br&gt;}&lt;br&gt;f = new foo3();&lt;br&gt;b = new baz();&lt;br&gt;f.bar(b);&lt;br&gt;&lt;br&gt;and expect 42.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=150609" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#150528</link><pubDate>Tue, 08 Jun 2004 02:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150528</guid><dc:creator>Eric Lippert</dc:creator><description>&amp;gt; For those cases where I *want* stricter checking (and allow for early binding optimizations), I would tend to add the appropriate annotation&lt;br&gt;&lt;br&gt;Quite amusing.  I said almost exactly the same thing back in 2000.  I'll blog more about this tomorrow.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=150528" width="1" height="1"&gt;</description></item><item><title>re: A JScript .NET Design Donnybrook</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/06/07/150367.aspx#150523</link><pubDate>Tue, 08 Jun 2004 02:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:150523</guid><dc:creator>James Hugard</dc:creator><description>Eric said:&lt;br&gt;&lt;br&gt;&amp;gt; Ah, but remember that I've blogged before&lt;br&gt;&amp;gt; that one of the design principles of JScript&lt;br&gt;&amp;gt; is &amp;quot;muddle on through&amp;quot;.&lt;br&gt;&lt;br&gt;True.&lt;br&gt;&lt;br&gt;In that case (and after reading the docs on &amp;quot;hide&amp;quot;), I would say 50.&lt;br&gt;&lt;br&gt;Why?  Because, again due to the philosophy of the previous version of JScript (and script languages in general), I would expect a late-bindy kind of behavior.  In the absence of a type specifier (e.g., for an Object), I would *always* perform/expect late-binding of method calls.&lt;br&gt;&lt;br&gt;Yes, this results in *much* slower code for the typical case, but it would be in line with my expectations.&lt;br&gt;&lt;br&gt;&amp;gt; However, remember that we added class&lt;br&gt;&amp;gt; inheritance to strengthen the type system&lt;br&gt;&amp;gt; so that people who wanted a more predictable,&lt;br&gt;&amp;gt; static, type-checked experience could have one.&lt;br&gt;&lt;br&gt;For those cases where I *want* stricter checking (and allow for early binding optimizations), I would tend to add the appropriate annotation.  Actually, I would have preferred (would still like) a compiler switch to require strict specification of type.  In fact, before Jscript was released I would have argued for it as an effect of –fast.  Today, it would be nice as its own switch.&lt;br&gt;&lt;br&gt;IMHO, an answer of 5 would make a compiler writer happy (it results in faster early-bound code) and an answer of &amp;quot;50&amp;quot; would make a user happy (it is what I, personally, would expect).&lt;br&gt;&lt;br&gt;Yes… I am surprised that the answer is in fact 5 :P&lt;br&gt;&lt;br&gt;Anyway, when it comes to the new Jscript.net features, I will now start out suspecting that the compiler will try to do the “fast” thing instead of the “scripty” thing; in this case, use the type in effect at the time of definition and do early binding.  Without giving it much thought, I would not be surprised to learn that this follows the model of other CLI languages (none of which I know very well).&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=150523" width="1" height="1"&gt;</description></item></channel></rss>