<?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>F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx</link><description>As you may have noticed on this blog lately that I’ve been focusing on Asynchronous Workflows. In those adventures, I’ve been taking well known APIs such as Twitter, Bing, among others and seeing what I can do with them. In this instance, when using LINQ</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx#7124487</link><pubDate>Tue, 16 Jun 2009 00:02:01 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7124487</guid><dc:creator>podwysocki</dc:creator><author>podwysocki</author><description>&lt;p&gt;@Michael,&lt;/p&gt;
&lt;p&gt;Yes, that's another form of Structural typing. I guess this was a bit confusing and I should clear that up.&lt;/p&gt;
&lt;p&gt;Matt&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7124487" width="1" height="1"&gt;</description></item><item><title>re: F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx#7121682</link><pubDate>Sun, 14 Jun 2009 08:17:38 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7121682</guid><dc:creator>Kurt Schelfthout</dc:creator><author>Kurt Schelfthout</author><description>&lt;p&gt;...the &amp;quot;Convert Damnit&amp;quot; operator...&lt;/p&gt;
&lt;p&gt;Heh. Good one. :)&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7121682" width="1" height="1"&gt;</description></item><item><title>re: F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx#7120209</link><pubDate>Sat, 13 Jun 2009 02:22:53 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7120209</guid><dc:creator>Michael Giagnocavo</dc:creator><author>Michael Giagnocavo</author><description>&lt;p&gt;@thelazydogsback -- The CLR doesn't support it directly (member constraints on generics), so C# doesn't either. It's only because the F# compiler has inlining and statically-resolved type parameters that we can do cool stuff like this.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7120209" width="1" height="1"&gt;</description></item><item><title>re: F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx#7120197</link><pubDate>Sat, 13 Jun 2009 01:30:01 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7120197</guid><dc:creator>Michael Giagnocavo</dc:creator><author>Michael Giagnocavo</author><description>&lt;p&gt;I thought structural typing was in contrast to nominative typing. If F# had structural typing, this would work:&lt;/p&gt;
&lt;p&gt;&amp;gt; type Foo = {x:int}&lt;/p&gt;
&lt;p&gt;type Bar = {x:int}&lt;/p&gt;
&lt;p&gt;let a : Foo = { x = 1 }&lt;/p&gt;
&lt;p&gt;let b : Bar = { x = 1 }&lt;/p&gt;
&lt;p&gt;a = b;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;a = b;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;----^&lt;/p&gt;
&lt;p&gt;stdin(5,5): error FS0001: This expression has type&lt;/p&gt;
&lt;p&gt;	Bar&lt;/p&gt;
&lt;p&gt;but is here used with type&lt;/p&gt;
&lt;p&gt;	Foo&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7120197" width="1" height="1"&gt;</description></item><item><title>re: F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx#7119546</link><pubDate>Fri, 12 Jun 2009 17:08:12 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7119546</guid><dc:creator>thelazydogsback</dc:creator><author>thelazydogsback</author><description>&lt;p&gt;&amp;gt; only known at compile-time &lt;/p&gt;
&lt;p&gt;--&amp;gt;&lt;/p&gt;
&lt;p&gt;only known at run-time &lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7119546" width="1" height="1"&gt;</description></item><item><title>re: F# – Duck Typing and Structural Typing</title><link>http://weblogs.asp.net/podwysocki/archive/2009/06/11/f-duck-typing-and-structural-typing.aspx#7118103</link><pubDate>Fri, 12 Jun 2009 00:27:20 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7118103</guid><dc:creator>thelazydogsback</dc:creator><author>thelazydogsback</author><description>&lt;p&gt; &amp;nbsp; &amp;nbsp; let inline getName arg =&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ( ^a : (member Name : string) arg)&lt;/p&gt;
&lt;p&gt;Pretty powerful - a nice blend of flexibility and compile-time safety.&lt;/p&gt;
&lt;p&gt;Am I correct in that the above code is not expressable in C# without code gen or reflection? (Ignoring that the implicit op would work in the case anyway.)&lt;/p&gt;
&lt;p&gt;Can the name be a quotation hole in case the name is only known at compile-time and we want to pregenerate the getter rather than use reflection each time?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7118103" width="1" height="1"&gt;</description></item></channel></rss>