<?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: Delphi Prism new language features</title>
	<atom:link href="http://blog.spreendigital.de/2008/11/21/delphi-prism-new-language-features/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.spreendigital.de/2008/11/21/delphi-prism-new-language-features/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=delphi-prism-new-language-features</link>
	<description>A blog about Delphi programming, web and other technical stuff</description>
	<lastBuildDate>Thu, 10 May 2012 06:28:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Dennis</title>
		<link>http://blog.spreendigital.de/2008/11/21/delphi-prism-new-language-features/comment-page-1/#comment-5</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Mon, 24 Nov 2008 15:34:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.spreendigital.de/blog/?p=84#comment-5</guid>
		<description>btw, what about nested for loops? Does this work with prism?

for i: Integer := 0 to 10 do
  for i: Integer := 0 to 20 do
    Console.Writeline(i)</description>
		<content:encoded><![CDATA[<p>btw, what about nested for loops? Does this work with prism?</p>
<p>for i: Integer := 0 to 10 do<br />
  for i: Integer := 0 to 20 do<br />
    Console.Writeline(i)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis</title>
		<link>http://blog.spreendigital.de/2008/11/21/delphi-prism-new-language-features/comment-page-1/#comment-4</link>
		<dc:creator>Dennis</dc:creator>
		<pubDate>Mon, 24 Nov 2008 15:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.spreendigital.de/blog/?p=84#comment-4</guid>
		<description>If you need variables for loops, maybe try to avoid them using the “for each” construct...


The Prism feature with the for loop variables:
&lt;code&gt;
var x := -1;
var list := new List&lt;Integer&gt;([1, 2, 3]);

for x in list do
  Console.Writeline(x)

Console.Writeline(x);

Output:

1
2
3
-1&lt;/code&gt;

At the end, x will still be -1, because it is a different variable than the x inside the loop. 

&quot;
(Taken from the prism wiki)

Is this good readable code? I don&#039;t think so. You&#039;ll use the &quot;x&quot; variable but inside the &quot;for&quot; loop it&#039;s a different &quot;x&quot; - same name, different behavior/content? The only thing I see is to use special variables only intended for use within for loops (like I,J,K,L) - which we do anyway.

Or why not using special prefixes (like in PHP, Perl, etc.) for those cases?

for $x in list do
  Console.Writeline(x)
?</description>
		<content:encoded><![CDATA[<p>If you need variables for loops, maybe try to avoid them using the “for each” construct&#8230;</p>
<p>The Prism feature with the for loop variables:<br />
<code><br />
var x := -1;<br />
var list := new List<integer>([1, 2, 3]);</p>
<p>for x in list do<br />
  Console.Writeline(x)</p>
<p>Console.Writeline(x);</p>
<p>Output:</p>
<p>1<br />
2<br />
3<br />
-1</integer></code></p>
<p>At the end, x will still be -1, because it is a different variable than the x inside the loop. </p>
<p>&#8221;<br />
(Taken from the prism wiki)</p>
<p>Is this good readable code? I don&#8217;t think so. You&#8217;ll use the &#8220;x&#8221; variable but inside the &#8220;for&#8221; loop it&#8217;s a different &#8220;x&#8221; &#8211; same name, different behavior/content? The only thing I see is to use special variables only intended for use within for loops (like I,J,K,L) &#8211; which we do anyway.</p>
<p>Or why not using special prefixes (like in PHP, Perl, etc.) for those cases?</p>
<p>for $x in list do<br />
  Console.Writeline(x)<br />
?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian P.R. Gingter</title>
		<link>http://blog.spreendigital.de/2008/11/21/delphi-prism-new-language-features/comment-page-1/#comment-2</link>
		<dc:creator>Sebastian P.R. Gingter</dc:creator>
		<pubDate>Mon, 24 Nov 2008 13:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.spreendigital.de/blog/?p=84#comment-2</guid>
		<description>I disagree in some degree ;-)
Of course it&#039;s very clean to have everytging you work on declared in front.

But if you need some variables for loops (like the allmighty &#039;for i := 0 to...&#039;), or only in scope of a loop, then it&#039;s a lot cleaner to not declare it oustide of that scope.

Being able to access a variable that was valid in a loop and might or might not be available for access later is generally a bad idea. Declaring a variable that is used only in a loop directly in that loop makes the code cleaner and more maintainable.</description>
		<content:encoded><![CDATA[<p>I disagree in some degree <img src='http://blog.spreendigital.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
Of course it&#8217;s very clean to have everytging you work on declared in front.</p>
<p>But if you need some variables for loops (like the allmighty &#8216;for i := 0 to&#8230;&#8217;), or only in scope of a loop, then it&#8217;s a lot cleaner to not declare it oustide of that scope.</p>
<p>Being able to access a variable that was valid in a loop and might or might not be available for access later is generally a bad idea. Declaring a variable that is used only in a loop directly in that loop makes the code cleaner and more maintainable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Diehl</title>
		<link>http://blog.spreendigital.de/2008/11/21/delphi-prism-new-language-features/comment-page-1/#comment-1</link>
		<dc:creator>Martin Diehl</dc:creator>
		<pubDate>Mon, 24 Nov 2008 11:36:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.spreendigital.de/blog/?p=84#comment-1</guid>
		<description>Yes, variable everywhere and create an instance at the same time you declare is really something I dislike too.
It mess up the code in a awfully way.</description>
		<content:encoded><![CDATA[<p>Yes, variable everywhere and create an instance at the same time you declare is really something I dislike too.<br />
It mess up the code in a awfully way.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

