<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Chiming in on Duck Typing vs Static Typing</title>
	<atom:link href="http://mihasya.com/blog/chiming-in-on-duck-typing-vs-static-typing/feed/" rel="self" type="application/rss+xml" />
	<link>http://mihasya.com/blog/chiming-in-on-duck-typing-vs-static-typing/</link>
	<description>good things now come in packages of three</description>
	<lastBuildDate>Wed, 04 Aug 2010 12:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Nolan Caudill</title>
		<link>http://mihasya.com/blog/chiming-in-on-duck-typing-vs-static-typing/comment-page-1/#comment-3816</link>
		<dc:creator>Nolan Caudill</dc:creator>
		<pubDate>Sun, 04 Jul 2010 07:45:10 +0000</pubDate>
		<guid isPermaLink="false">http://mihasya.com/blog/?p=307#comment-3816</guid>
		<description>&lt;p&gt;I know I&#039;m &lt;em&gt;way&lt;/em&gt; late to this party, but I think the term Adam is looking for is &quot;type inference&quot; which is the ability of the compiler/interpreter to deduce what type you meant instead of the programmer explicitly typing it out.&lt;/p&gt;

&lt;p&gt;Personally, I&#039;m in the Richard camp, loving the extra checking the compiler gives me though I hate typing out instantiations like &quot;Foo foo = new Foo()&quot; that languages with little to no type inference (such as Java and C++) force you to do. C++ and Java both have terrible type systems, giving you all the pain of the extra typing with only really helping the developer at runtime at the subtle type displacements. What these languages missing are type inference.&lt;/p&gt;

&lt;p&gt;Haskell, for example, has a fantastic type system. You specify what types a function takes and returns and if you violate this compact, either through function calls or returns, the compilation fails. This forces you to reason strongly about your program and the common thought in Haskell is if it compiles, it works. This even also allows Haskell to do crazy things like automatically generating testing suites--the type system is that strong. Even better, you don&#039;t have t0 tell the compiler what type every value has, it figures it out for itself through its inference.&lt;/p&gt;

&lt;p&gt;With disciplined developers and rigorous testing, (obviously) dynamic languages work. The issue with dynamic languages is that the developers &lt;em&gt;have&lt;/em&gt; to be disciplined and the checks they have to put in to deal with the &quot;what is this&quot; issues is simply and elegantly handled with strongly, statically typed languages with &lt;em&gt;good&lt;/em&gt; type inference.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I know I&#8217;m <em>way</em> late to this party, but I think the term Adam is looking for is &#8220;type inference&#8221; which is the ability of the compiler/interpreter to deduce what type you meant instead of the programmer explicitly typing it out.</p>

<p>Personally, I&#8217;m in the Richard camp, loving the extra checking the compiler gives me though I hate typing out instantiations like &#8220;Foo foo = new Foo()&#8221; that languages with little to no type inference (such as Java and C++) force you to do. C++ and Java both have terrible type systems, giving you all the pain of the extra typing with only really helping the developer at runtime at the subtle type displacements. What these languages missing are type inference.</p>

<p>Haskell, for example, has a fantastic type system. You specify what types a function takes and returns and if you violate this compact, either through function calls or returns, the compilation fails. This forces you to reason strongly about your program and the common thought in Haskell is if it compiles, it works. This even also allows Haskell to do crazy things like automatically generating testing suites&#8211;the type system is that strong. Even better, you don&#8217;t have t0 tell the compiler what type every value has, it figures it out for itself through its inference.</p>

<p>With disciplined developers and rigorous testing, (obviously) dynamic languages work. The issue with dynamic languages is that the developers <em>have</em> to be disciplined and the checks they have to put in to deal with the &#8220;what is this&#8221; issues is simply and elegantly handled with strongly, statically typed languages with <em>good</em> type inference.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://mihasya.com/blog/chiming-in-on-duck-typing-vs-static-typing/comment-page-1/#comment-3586</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Wed, 16 Dec 2009 07:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://mihasya.com/blog/?p=307#comment-3586</guid>
		<description>&lt;p&gt;Turkey typing seems to be exactly like ocaml and the ml family of languages &#039;type hinting&#039; (I don&#039;t really know what its called). Its not new, and not having comments do suck.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Turkey typing seems to be exactly like ocaml and the ml family of languages &#8216;type hinting&#8217; (I don&#8217;t really know what its called). Its not new, and not having comments do suck.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: mihasya</title>
		<link>http://mihasya.com/blog/chiming-in-on-duck-typing-vs-static-typing/comment-page-1/#comment-3304</link>
		<dc:creator>mihasya</dc:creator>
		<pubDate>Sat, 26 Sep 2009 18:14:01 +0000</pubDate>
		<guid isPermaLink="false">http://mihasya.com/blog/?p=307#comment-3304</guid>
		<description>&lt;p&gt;I do see exactly what he&#039;s trying to do - an optional &quot;type hint&quot; in method signatures. All of my points are aimed at that argument.&lt;/p&gt;

&lt;p&gt;Richard&#039;s syntax is fine if all you&#039;re interested in is the type. However, he is interested in the capabilities. So the part that didn&#039;t make it into his post is that you&#039;d have to define an interface-like structure somewhere to say what &quot;iterable&quot; means - what methods it has to support in order to satisfy the requirement. Then you get to the part where you also have to define the signatures for all those methods. If those methods have turkey type requirements, you have to define all of those subtypes somewhere too. To me, it seems easier to just do (pseudo)&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;if (foo.&lt;strong&gt;iter&lt;/strong&gt;):
    for bar in foo:
        if isinstance(bar, SomeClass):
            bar.DoEeeeet()
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;I&#039;ll concede that I&#039;ve presented another weak example after pointing out weaknesses in Richards. Your point is well taken.&lt;/p&gt;

&lt;p&gt;The more I think about it, the more I don&#039;t see why this has to be a syntax change at all. I believe what Richard wants can be accomplished using some pretty generic helpers. Maybe I&#039;ll talk to him about that possibility.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I do see exactly what he&#8217;s trying to do &#8211; an optional &#8220;type hint&#8221; in method signatures. All of my points are aimed at that argument.</p>

<p>Richard&#8217;s syntax is fine if all you&#8217;re interested in is the type. However, he is interested in the capabilities. So the part that didn&#8217;t make it into his post is that you&#8217;d have to define an interface-like structure somewhere to say what &#8220;iterable&#8221; means &#8211; what methods it has to support in order to satisfy the requirement. Then you get to the part where you also have to define the signatures for all those methods. If those methods have turkey type requirements, you have to define all of those subtypes somewhere too. To me, it seems easier to just do (pseudo)</p>

<p><pre><code>if (foo.<strong>iter</strong>):
    for bar in foo:
        if isinstance(bar, SomeClass):
            bar.DoEeeeet()
</code></pre></p>

<p>I&#8217;ll concede that I&#8217;ve presented another weak example after pointing out weaknesses in Richards. Your point is well taken.</p>

<p>The more I think about it, the more I don&#8217;t see why this has to be a syntax change at all. I believe what Richard wants can be accomplished using some pretty generic helpers. Maybe I&#8217;ll talk to him about that possibility.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: David Hall</title>
		<link>http://mihasya.com/blog/chiming-in-on-duck-typing-vs-static-typing/comment-page-1/#comment-3287</link>
		<dc:creator>David Hall</dc:creator>
		<pubDate>Fri, 25 Sep 2009 02:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://mihasya.com/blog/?p=307#comment-3287</guid>
		<description>&lt;p&gt;What I don&#039;t get in people&#039;s criticisms of Richard is that they assume you have to specify a type.  I don&#039;t see why we can&#039;t have the ability to specify types in methods if we want to, and get duck typing if we don&#039;t do it.&lt;/p&gt;

&lt;p&gt;Where python really fails is that if you want this strictness, it makes it a horrible pain to achieve, if not impossible.  And while I consider Richard&#039;s syntax examples ugly, they&#039;re far prettier than what someone has to do in python.&lt;/p&gt;

&lt;p&gt;Your Photo/Video example is semi-silly.  You know that even in these &quot;generic&quot; actions, the first time they were coded, they likely have Photo-specific code in them.  So, you need to go through them and fix that when you decide you&#039;re going to do video.  That&#039;s just a given.  And if it truly generic, Richard&#039;s Turkey-typing does not require superclasses, just you to specify [Photo,Video] instead of Photo, once you verify the method is not Photo-specific.&lt;/p&gt;

&lt;p&gt;I tend to fall on Richard&#039;s side on this one, but maybe that&#039;s because I live in a world where sometimes the people you write code with weren&#039;t hired for their coding, but instead for their knowledge of chemistry, and it just so happens that they need to write some code to try out some ideas, and you want it to be in an easy dynamic language, but you find them running into things like what Richard discusses in his posts.  And C has different problems.  I feel like Richard&#039;s ideas would result in a better Python ecosystem, where there are clearer error messages instead of some deep backtrace of an uncaught exception (often from a C extension when you&#039;re in the world of scientific computing, which means the deepest levels of the backtrace are not in Python and not your standard ValueError type problems).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>What I don&#8217;t get in people&#8217;s criticisms of Richard is that they assume you have to specify a type.  I don&#8217;t see why we can&#8217;t have the ability to specify types in methods if we want to, and get duck typing if we don&#8217;t do it.</p>

<p>Where python really fails is that if you want this strictness, it makes it a horrible pain to achieve, if not impossible.  And while I consider Richard&#8217;s syntax examples ugly, they&#8217;re far prettier than what someone has to do in python.</p>

<p>Your Photo/Video example is semi-silly.  You know that even in these &#8220;generic&#8221; actions, the first time they were coded, they likely have Photo-specific code in them.  So, you need to go through them and fix that when you decide you&#8217;re going to do video.  That&#8217;s just a given.  And if it truly generic, Richard&#8217;s Turkey-typing does not require superclasses, just you to specify [Photo,Video] instead of Photo, once you verify the method is not Photo-specific.</p>

<p>I tend to fall on Richard&#8217;s side on this one, but maybe that&#8217;s because I live in a world where sometimes the people you write code with weren&#8217;t hired for their coding, but instead for their knowledge of chemistry, and it just so happens that they need to write some code to try out some ideas, and you want it to be in an easy dynamic language, but you find them running into things like what Richard discusses in his posts.  And C has different problems.  I feel like Richard&#8217;s ideas would result in a better Python ecosystem, where there are clearer error messages instead of some deep backtrace of an uncaught exception (often from a C extension when you&#8217;re in the world of scientific computing, which means the deepest levels of the backtrace are not in Python and not your standard ValueError type problems).</p>]]></content:encoded>
	</item>
</channel>
</rss>
