<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/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>Tales from the Evil Empire : Script#</title><link>http://weblogs.asp.net/bleroy/archive/tags/Script_2300_/default.aspx</link><description>Tags: Script#</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Can you say "qwak"? OK, then fly.</title><link>http://weblogs.asp.net/bleroy/archive/2006/07/31/Can-you-say-_2200_qwak_22003F00_-OK_2C00_-then-fly_2C00_-now_2E00_.aspx</link><pubDate>Mon, 31 Jul 2006 21:10:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:461773</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=461773</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2006/07/31/Can-you-say-_2200_qwak_22003F00_-OK_2C00_-then-fly_2C00_-now_2E00_.aspx#comments</comments><description>&lt;p&gt;This morning, I was at a language symposium that&amp;#39;s taking place on the Microsoft campus. Many language gurus are there, Anders is doing the keynote, so it&amp;#39;s definitely a place where you can learn a thing or two. Many of the talks are about dynamic languages and how to implement them in the CLR, and as usual, you can see the usual &lt;a href="http://en.wikipedia.org/wiki/Duck_typing" target="_blank" title="duck-typing"&gt;duck-typing&lt;/a&gt; quote on all slide decks:&lt;/p&gt;&lt;p&gt;&amp;quot;If it walks like a duck and quacks like a duck, it must be a duck.&amp;quot;&lt;/p&gt;&lt;p&gt;Really, folks, I don&amp;#39;t know about that. While I generally like dynamic languages and the trend they represent, I&amp;#39;ve always been extremely uneasy about that, and what&amp;#39;s more I don&amp;#39;t think it&amp;#39;s a necessary outcome of using a dynamic language.&lt;/p&gt;&lt;p&gt;First, we don&amp;#39;t know that it walks &amp;quot;like a duck&amp;quot; and quacks &amp;quot;like a duck&amp;quot;. We know that it walks because it has a &amp;quot;walk&amp;quot; method, and we know that it quacks because it has a &amp;quot;quack&amp;quot; method. But nothing tells us that it actually walks like a duck. My daughter got&amp;nbsp;a walk method two years ago, and she has a quack method that she uses all the time. You can ask&amp;nbsp;her to walk and you can ask&amp;nbsp;her to quack, but that doesn&amp;#39;t make&amp;nbsp;her a duck (no matter how hard she likes to pretend she really is).&lt;/p&gt;&lt;p&gt;Look at the walk method. I can ask a duck to walk, yes, but I can also have a walk method on a tree structure. One will make the object change its position, the other wil enumerate all the nodes in the tree. Same name, very different behavior. And given that most dynamic languages don&amp;#39;t even enable you to look at/check the list of arguments, their types, and the type of the return value (like, say, a .NET delegate lets you), there&amp;#39;s no way you can tell.&lt;/p&gt;&lt;p&gt;What you need is some kind of a contract that&amp;#39;s more rigorous than just a name. Wait a minute, isn&amp;#39;t that what an interface is supposed to be? Sure is. That&amp;#39;s why we added interfaces to Atlas (which also brings the nice benefit that one operation is enough to verify the whole contract, you don&amp;#39;t need to check each and every method).&lt;/p&gt;&lt;p&gt;Of course, if you&amp;#39;ve been using a dynamic language lately, you&amp;#39;ll answer that yes, there are problems, but they are outweighted by the increased productivity of dynamic typing. Sure, that may be true in the prototyping phase, but as soon as your project is going to reach a critical size, it&amp;#39;s going to become increasingly difficult to maintain. Testing, I can hear dynamic language fans say, will alleviate this problem. No, it won&amp;#39;t because that means that I&amp;#39;ll need to write tests for stuff that a compiler is supposed to check. Tests that are not only boring to write but that will also nullify the benefit of saving a few characters&amp;nbsp;by not giving the type of my parameters in the first place. Furthermore, compilers are very complex pieces of code and coming up with equivalent tests is extremely difficult if not impossible. There&amp;#39;s always the possibility of doing the type-checking at runtime (which is what we&amp;#39;re doing in Atlas debug builds) but that&amp;#39;s both expensive in terms of performance and&amp;nbsp;only partially valid when compared to compiler-validation because you can&amp;#39;t check every possible case, you only check what the consumer code is giving you to check.&amp;nbsp;That&amp;#39;s why you see things like &lt;a href="http://projects.nikhilk.net/Projects/ScriptSharp.aspx" target="_blank" title="Script#"&gt;Script#&lt;/a&gt; emerging...&lt;/p&gt;&lt;p&gt;Finally, I&amp;#39;d like to point out that it&amp;#39;s not because a language is dynamic that it can&amp;#39;t be strongly-typed. The concept of a contract that the class and its consumers both know and agree on is orthogonal to the concept of dynamically adding to a type. And there is the Object type to deal with the completely unknown in the very rare cases where that&amp;#39;s necessary.&lt;/p&gt;&lt;p&gt;I&amp;#39;d like to hear your thoughts and reactions about that.&lt;/p&gt;&lt;p&gt;Further reading on this subject:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Duck typing on Wikipedia:&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Duck_typing"&gt;http://en.wikipedia.org/wiki/Duck_typing&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Cedric Beust makes other interesting points on duck-typing, mainly around the idea that duck-typing hides the contract in the implementation:&lt;br /&gt;&lt;a href="http://www.beust.com/weblog/archives/000269.html"&gt;http://www.beust.com/weblog/archives/000269.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A nice introduction to duck-typing for statically-typed language developers which puts the burden of type-checking on documentation and unit testing:&lt;br /&gt;&lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/100511"&gt;http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/100511&lt;/a&gt;&lt;br /&gt;Interesting quote: &amp;quot;I have found that once I stopped assuming that the callers of my method [...] are stupid and don&amp;#39;t know how to read my documentation&amp;nbsp;[...] then writing in Ruby became a whole lot more natural and somewhat less verbose&amp;quot;. Well, natural and less verbose certainly, but your callers may not be stupid and still have bugs in their code. If your code just crashes at some random place with a cryptic error message&amp;nbsp;because it&amp;#39;s expecting a duck and got a dukc, the more explicit an error message you give the better. At least that&amp;#39;s what our users are telling us.&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=461773" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Script_2300_/default.aspx">Script#</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/JavaScript/default.aspx">JavaScript</category></item><item><title>Script# brings compile-time and C# niceties to JavaScript development</title><link>http://weblogs.asp.net/bleroy/archive/2006/05/23/Script_2300_-brings-compile-time-and-C_2300_-niceties-to-JavaScript-development.aspx</link><pubDate>Tue, 23 May 2006 22:25:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:448789</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/bleroy/rsscomments.aspx?PostID=448789</wfw:commentRss><comments>http://weblogs.asp.net/bleroy/archive/2006/05/23/Script_2300_-brings-compile-time-and-C_2300_-niceties-to-JavaScript-development.aspx#comments</comments><description>&lt;P&gt;I'm very excited to finally be able to point to this post of Nikhil's. I've known about this project from the start and am Super-Ultra-Mega-Excited (this expression (c) Andres Sanabria) about it, but until now I had to keep my mouth shut.&lt;/P&gt;
&lt;P&gt;JavaScript is in many ways a very powerful language, but it lacks a compile-time (bye bye type checking) and OOP is very unnatural. While some consider it the best language ever, most people who come from C# or Java just go "ugh!" the first time they have to write anything beyond a click event handler with it. Some continue to strongly dislike it even after they've gained expertise with it. I'm not judging, but...&lt;/P&gt;
&lt;P&gt;Wouldn't it be nice to keep the power of dynamic scripting languages but with all the niceties of statically typed languages?&lt;/P&gt;
&lt;P&gt;Enter Script#, a project Nikhil started on his spare time (how much spare time this guy has has always been a mystery to me).&lt;/P&gt;
&lt;P&gt;Watch the screencast:&lt;BR&gt;&lt;A href="http://www.nikhilk.net/Content/Video/ScriptSharpIntro.wmv"&gt;http://www.nikhilk.net/Content/Video/ScriptSharpIntro.wmv&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Read the first blog post:&lt;BR&gt;&lt;A href="http://www.nikhilk.net/ScriptSharpIntro.aspx"&gt;http://www.nikhilk.net/ScriptSharpIntro.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And tell him what you think.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=448789" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bleroy/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Atlas/default.aspx">Atlas</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/bleroy/archive/tags/Script_2300_/default.aspx">Script#</category></item></channel></rss>