<?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"
	>
<channel>
	<title>Comments on: Generics, Commas, and Semicolons</title>
	<atom:link href="http://blogs.teamb.com/craigstuntz/2009/02/09/38000/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/</link>
	<description>C# • Entity Framework • Functional Programming • MVC • Web</description>
	<pubDate>Sun, 12 Feb 2012 04:07:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Surendran Bangalore</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-13935</link>
		<dc:creator>Surendran Bangalore</dc:creator>
		<pubDate>Fri, 05 Feb 2010 08:46:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-13935</guid>
		<description>With reg. to my post above. 

I think, the angle brackets (for generics code my my pasted code) is being removed while rendering html (I mean I pasted the full code but found that the "" are not coming.
Pasting the line again below,

"TPair= class   // declares TPair type with two type parameters"</description>
		<content:encoded><![CDATA[<p>With reg. to my post above. </p>
<p>I think, the angle brackets (for generics code my my pasted code) is being removed while rendering html (I mean I pasted the full code but found that the "" are not coming.<br />
Pasting the line again below,</p>
<p>"TPair= class   // declares TPair type with two type parameters"</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Surendran Bangalore</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-13934</link>
		<dc:creator>Surendran Bangalore</dc:creator>
		<pubDate>Fri, 05 Feb 2010 08:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-13934</guid>
		<description>One question in Delphi 2010, the help section mentions only commas (not semi colons) at the declaration section I am pasting the link and code section also.

Am I missing anything? Could you please explain reg. the discrepancy?

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; Because the comma and the semicolon mean different things. Read Rudy's comment above (plus the discussions which follow); does that explain it for you?&lt;/em&gt;&lt;/blockquote&gt;

Delphi 2010 help section
=================
ms-help://embarcadero.rs2010/rad/Overview_of_Generics.html

Code Example
==========
&lt;code&gt;type
  TPair= class&#60;TKey; TValue&#62;   // declares TPair type with two type parameters

  private
    FKey: TKey;
    FValue: TValue;
  public
    function GetKey: TKey;
    procedure SetKey(Key: TKey);
    function GetValue: TValue;
    procedure SetValue(Value: TValue);
    property Key: TKey read GetKey write SetKey;
    property Value: TValue read GetValue write SetValue;
  end;

type
  TSIPair = TPair; // declares instantiated type
  TSSPair = TPair;  // declares with other data types
  TISPair = TPair;
  TIIPair = TPair;
  TSXPair = TPair;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>One question in Delphi 2010, the help section mentions only commas (not semi colons) at the declaration section I am pasting the link and code section also.</p>
<p>Am I missing anything? Could you please explain reg. the discrepancy?</p>
<blockquote><p><em><strong>Response:</strong> Because the comma and the semicolon mean different things. Read Rudy&#8217;s comment above (plus the discussions which follow); does that explain it for you?</em></p></blockquote>
<p>Delphi 2010 help section<br />
=================<br />
ms-help://embarcadero.rs2010/rad/Overview_of_Generics.html</p>
<p>Code Example<br />
==========<br />
<code>type<br />
  TPair= class&lt;TKey; TValue&gt;   // declares TPair type with two type parameters</p>
<p>  private<br />
    FKey: TKey;<br />
    FValue: TValue;<br />
  public<br />
    function GetKey: TKey;<br />
    procedure SetKey(Key: TKey);<br />
    function GetValue: TValue;<br />
    procedure SetValue(Value: TValue);<br />
    property Key: TKey read GetKey write SetKey;<br />
    property Value: TValue read GetValue write SetValue;<br />
  end;</p>
<p>type<br />
  TSIPair = TPair; // declares instantiated type<br />
  TSSPair = TPair;  // declares with other data types<br />
  TISPair = TPair;<br />
  TIIPair = TPair;<br />
  TSXPair = TPair;</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rudy Velthuis</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-4562</link>
		<dc:creator>Rudy Velthuis</dc:creator>
		<pubDate>Wed, 25 Feb 2009 20:09:46 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-4562</guid>
		<description>&#62; In your case, TypeParamone has to support ISomething. In my case, it does not.

I was aware of that. I was merely explaining that ; ought to be the normal way of separating them when you are DECLARING parametric types, and that the comma is actually meant to give two parametric types the same constraint(s), just like ; is required to separate parameters in a function parameter list, and that the comma is used to give two parameters the same type. Of course, if you don't define any constraints anyway, it doesn't matter whether you use ; or , . I still think it is safer to ALWAYS use ; unless you want to give them the same constraints.

My comment got a little mixed up. I already said that using the comma would give both parametric types the same constraint, but the &#60; and &#62; were seen as HTML tags so the generic parts got missing.</description>
		<content:encoded><![CDATA[<p>&gt; In your case, TypeParamone has to support ISomething. In my case, it does not.</p>
<p>I was aware of that. I was merely explaining that ; ought to be the normal way of separating them when you are DECLARING parametric types, and that the comma is actually meant to give two parametric types the same constraint(s), just like ; is required to separate parameters in a function parameter list, and that the comma is used to give two parameters the same type. Of course, if you don&#8217;t define any constraints anyway, it doesn&#8217;t matter whether you use ; or , . I still think it is safer to ALWAYS use ; unless you want to give them the same constraints.</p>
<p>My comment got a little mixed up. I already said that using the comma would give both parametric types the same constraint, but the &lt; and &gt; were seen as HTML tags so the generic parts got missing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-4521</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Wed, 18 Feb 2009 19:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-4521</guid>
		<description>Rudy, that is valid, indeed, but has different meaning in the code I posted. In your case, TypeParam1 has to support ISomething. In my case, it does not.</description>
		<content:encoded><![CDATA[<p>Rudy, that is valid, indeed, but has different meaning in the code I posted. In your case, TypeParam1 has to support ISomething. In my case, it does not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rudy Velthuis</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-4519</link>
		<dc:creator>Rudy Velthuis</dc:creator>
		<pubDate>Wed, 18 Feb 2009 19:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-4519</guid>
		<description>The following is valid too:

  TFoo = class&#60;TypeParam1, TypeParam2: ISomething&#62;

But this means that both type params have the same constraint, ISomething. This is in analogy to

  procedure Foo(Param1, Param2: ISomething);

Now if there are multiple type params, and all are unconstrained, you can use commas as well as semicolons:

  TBar&#60;K; Y&#62;

or

  TBar&#60;K, Y&#62;

are the same. But I would say that, in a declaration, it is best to always use semicolons to separate type parameters, to avoid complications if you want to add constraints at a later date.
</description>
		<content:encoded><![CDATA[<p>The following is valid too:</p>
<p>  TFoo = class&lt;TypeParam1, TypeParam2: ISomething&gt;</p>
<p>But this means that both type params have the same constraint, ISomething. This is in analogy to</p>
<p>  procedure Foo(Param1, Param2: ISomething);</p>
<p>Now if there are multiple type params, and all are unconstrained, you can use commas as well as semicolons:</p>
<p>  TBar&lt;K; Y&gt;</p>
<p>or</p>
<p>  TBar&lt;K, Y&gt;</p>
<p>are the same. But I would say that, in a declaration, it is best to always use semicolons to separate type parameters, to avoid complications if you want to add constraints at a later date.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-4508</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Tue, 17 Feb 2009 13:22:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-4508</guid>
		<description>"It?" You mean generics? 

I have given lots of examples of generics on this blog, such as &lt;a href="http://blogs.teamb.com/craigstuntz/2008/10/01/37839/" rel="nofollow"&gt;this one&lt;/a&gt;. If you have read all of those examples and there is still something specific that you don't understand, then you should clarify the question. 

In general, you should not expect more effort in a response to a question than you put into asking the question in the first place.</description>
		<content:encoded><![CDATA[<p>"It?" You mean generics? </p>
<p>I have given lots of examples of generics on this blog, such as <a href="http://blogs.teamb.com/craigstuntz/2008/10/01/37839/" rel="nofollow">this one</a>. If you have read all of those examples and there is still something specific that you don&#8217;t understand, then you should clarify the question. </p>
<p>In general, you should not expect more effort in a response to a question than you put into asking the question in the first place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Baalbaki</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-4507</link>
		<dc:creator>Baalbaki</dc:creator>
		<pubDate>Tue, 17 Feb 2009 13:13:20 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-4507</guid>
		<description>Really confused...
Can any one describe to us how we can use it in the real world?
a very simple scenario would be great.
thanks</description>
		<content:encoded><![CDATA[<p>Really confused&#8230;<br />
Can any one describe to us how we can use it in the real world?<br />
a very simple scenario would be great.<br />
thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

