<?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 for DelphiTools.info</title>
	<atom:link href="http://delphitools.info/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://delphitools.info</link>
	<description>SamplingProfiler, DWS and other Delphi tools</description>
	<lastBuildDate>Tue, 15 May 2012 07:53:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on Partial Classes in DWScript by Eric</title>
		<link>http://delphitools.info/2012/05/14/partial-classes-in-dwscript/comment-page-1/#comment-2273</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 15 May 2012 07:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1863#comment-2273</guid>
		<description>&lt;blockquote cite=&quot;#commentbody-2272&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-2272&quot; rel=&quot;nofollow&quot;&gt;Mason Wheeler&lt;/a&gt; :&lt;/strong&gt;
&lt;p&gt;…which can be done just as easily with IFDEFs, which has the further advantage of making your intentions explicit.&lt;/p&gt;
&lt;/blockquote&gt;
I&#039;m not a fan of IFDEFs, since they mingle optional or platform-specific code with regular code, they are often a PITA to deal with in greater code-bases, and you need to run multiple builds with all the various IFDEF conditionals to check everything.

If you composite with partial classes, then you get compile-time checks with a single-build, and you can segregate optional functionality to optional files in a much cleaner way than using IFDEF/INCLUDES (especially since with IFDEF/INCLUDES, you would need one file for the declaration, another for the implementation, like in C).

For instance in Delphi that means you could have optional LiveBinding capability for components, without having forced LiveBinding dependencies even if you don&#039;t need them.

As for dynamic/RTTI description, I&#039;m of two minds there: on one side having a separate DFM/XML is convenient, on the other, it means you end up with RTTI and runtime errors, where you could have had static typing and compile time errors, ie. the flexibility you get comes at a stability price. And refactoring code with compiler support is simple, refactoring resources DFM/XML isn&#039;t.

&lt;blockquote&gt;Enables separation of a class’s interface and implementation code in a unique way.&lt;/blockquote&gt;
Good point, this one was copy-pasted and is irrelevant to Pascal, I&#039;ll scratch it from the list.

&lt;blockquote&gt;And wouldn’t a class big enough to be broken up this way violate SRP anyway?&lt;/blockquote&gt;
Sometimes, classes just have to be big to be practical IME (of course that shouldn&#039;t be abused), or you end up with overcomplicated architectures or &quot;public everything&quot;.
Think of TComponent, and other base classes that introduce support for multiple interfaces.

Partial classes can turn especially useful for interfaces, as you can segregate the interface declaration &amp; implementation in another, optional unit.

&lt;blockquote&gt;…huh?  How do you make navigation easier by giving it more files to lookup and keep track of?&lt;/blockquote&gt;
By making the file focused on one aspect, f.i. if you use the partial class to implement an IPrintable interface, or an IDragDropAble, etc. You&#039;ll have a bunch of related methods that extend the class, and are intrinsically optional, and exchangeable.

F.i. even if you don&#039;t like the Delphi LiveBinding implementation, you&#039;ll have to deal with it, or at least carry it around as RTTI dead weight. If it had been made into a partial class, you could have avoided it if you were not using it, or replaced it with some different design/implementation.</description>
		<content:encoded><![CDATA[<blockquote cite="#commentbody-2272"><p>
<strong><a href="#comment-2272" rel="nofollow">Mason Wheeler</a> :</strong></p>
<p>…which can be done just as easily with IFDEFs, which has the further advantage of making your intentions explicit.</p>
</blockquote>
<p>I&#8217;m not a fan of IFDEFs, since they mingle optional or platform-specific code with regular code, they are often a PITA to deal with in greater code-bases, and you need to run multiple builds with all the various IFDEF conditionals to check everything.</p>
<p>If you composite with partial classes, then you get compile-time checks with a single-build, and you can segregate optional functionality to optional files in a much cleaner way than using IFDEF/INCLUDES (especially since with IFDEF/INCLUDES, you would need one file for the declaration, another for the implementation, like in C).</p>
<p>For instance in Delphi that means you could have optional LiveBinding capability for components, without having forced LiveBinding dependencies even if you don&#8217;t need them.</p>
<p>As for dynamic/RTTI description, I&#8217;m of two minds there: on one side having a separate DFM/XML is convenient, on the other, it means you end up with RTTI and runtime errors, where you could have had static typing and compile time errors, ie. the flexibility you get comes at a stability price. And refactoring code with compiler support is simple, refactoring resources DFM/XML isn&#8217;t.</p>
<blockquote><p>Enables separation of a class’s interface and implementation code in a unique way.</p></blockquote>
<p>Good point, this one was copy-pasted and is irrelevant to Pascal, I&#8217;ll scratch it from the list.</p>
<blockquote><p>And wouldn’t a class big enough to be broken up this way violate SRP anyway?</p></blockquote>
<p>Sometimes, classes just have to be big to be practical IME (of course that shouldn&#8217;t be abused), or you end up with overcomplicated architectures or &#8220;public everything&#8221;.<br />
Think of TComponent, and other base classes that introduce support for multiple interfaces.</p>
<p>Partial classes can turn especially useful for interfaces, as you can segregate the interface declaration &#038; implementation in another, optional unit.</p>
<blockquote><p>…huh?  How do you make navigation easier by giving it more files to lookup and keep track of?</p></blockquote>
<p>By making the file focused on one aspect, f.i. if you use the partial class to implement an IPrintable interface, or an IDragDropAble, etc. You&#8217;ll have a bunch of related methods that extend the class, and are intrinsically optional, and exchangeable.</p>
<p>F.i. even if you don&#8217;t like the Delphi LiveBinding implementation, you&#8217;ll have to deal with it, or at least carry it around as RTTI dead weight. If it had been made into a partial class, you could have avoided it if you were not using it, or replaced it with some different design/implementation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Partial Classes in DWScript by Mason Wheeler</title>
		<link>http://delphitools.info/2012/05/14/partial-classes-in-dwscript/comment-page-1/#comment-2272</link>
		<dc:creator>Mason Wheeler</dc:creator>
		<pubDate>Mon, 14 May 2012 17:07:52 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1863#comment-2272</guid>
		<description>Ouch!  I really don&#039;t see this as a good or useful feature.  Let&#039;s see here:

&gt; Facilitates the implementation of code generators that have to “inject” code declarations/implementations that comes form other descriptions, such as a Visual UI designer, data and string resources, etc.

Yeah, this is why .NET has partial classes.  Instead of using a form-definition language like Delphi, they added all sorts of unnecessary complications and difficulties to Winforms by doing the whole thing in code.  (I can&#039;t help but wonder if part of the motivation for XAML didn&#039;t come from them finally realizing what we had known all along: that that&#039;s a horrible way to set up forms.)

&gt; Enables separation of concerns, in a way similar to aspect-oriented programming but without using any extra tools.

If you&#039;re trying to separate concerns, why are you putting them together in the same class?

&gt; Enables optionally composited functionality, which can be omitted or substituted depending on target or requirements..

...which can be done just as easily with IFDEFs, which has the further advantage of making your intentions explicit.

&gt; Enables separation of a class’s interface and implementation code in a unique way.

&quot;Unique&quot; unless you mean &quot;the same as how C and C++ do it,&quot; which is a horrible model. There&#039;s a good reason why .h files don&#039;t show up in other languages.

&gt; Enables multiple developers to work on a single class concurrently without the need to merge individual code into one file at a later time.

Enables multiple developers to develop parts of a class independently, with no coordination, so you end up with a mess of a class whose parts don&#039;t work together well.  (And wouldn&#039;t a class big enough to be broken up this way violate SRP anyway?)

&gt;Eases navigation through large classes within a editor.

...huh?  How do you make navigation easier by giving it more files to lookup and keep track of?</description>
		<content:encoded><![CDATA[<p>Ouch!  I really don&#8217;t see this as a good or useful feature.  Let&#8217;s see here:</p>
<p>&gt; Facilitates the implementation of code generators that have to “inject” code declarations/implementations that comes form other descriptions, such as a Visual UI designer, data and string resources, etc.</p>
<p>Yeah, this is why .NET has partial classes.  Instead of using a form-definition language like Delphi, they added all sorts of unnecessary complications and difficulties to Winforms by doing the whole thing in code.  (I can&#8217;t help but wonder if part of the motivation for XAML didn&#8217;t come from them finally realizing what we had known all along: that that&#8217;s a horrible way to set up forms.)</p>
<p>&gt; Enables separation of concerns, in a way similar to aspect-oriented programming but without using any extra tools.</p>
<p>If you&#8217;re trying to separate concerns, why are you putting them together in the same class?</p>
<p>&gt; Enables optionally composited functionality, which can be omitted or substituted depending on target or requirements..</p>
<p>&#8230;which can be done just as easily with IFDEFs, which has the further advantage of making your intentions explicit.</p>
<p>&gt; Enables separation of a class’s interface and implementation code in a unique way.</p>
<p>&#8220;Unique&#8221; unless you mean &#8220;the same as how C and C++ do it,&#8221; which is a horrible model. There&#8217;s a good reason why .h files don&#8217;t show up in other languages.</p>
<p>&gt; Enables multiple developers to work on a single class concurrently without the need to merge individual code into one file at a later time.</p>
<p>Enables multiple developers to develop parts of a class independently, with no coordination, so you end up with a mess of a class whose parts don&#8217;t work together well.  (And wouldn&#8217;t a class big enough to be broken up this way violate SRP anyway?)</p>
<p>&gt;Eases navigation through large classes within a editor.</p>
<p>&#8230;huh?  How do you make navigation easier by giving it more files to lookup and keep track of?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Partial Classes in DWScript by Eric</title>
		<link>http://delphitools.info/2012/05/14/partial-classes-in-dwscript/comment-page-1/#comment-2271</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Mon, 14 May 2012 12:00:27 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1863#comment-2271</guid>
		<description>&lt;blockquote cite=&quot;#commentbody-2270&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-2270&quot; rel=&quot;nofollow&quot;&gt;Stefan Glienke&lt;/a&gt; :&lt;/strong&gt;
Wow! I wonder when you will add full AOP support to DWS  
&lt;/blockquote&gt;
Partial classes were a low-hanging fruit, actually, at some point all class were partial &quot;courtesy&quot; of a compiler bug ;-)
That said, before AOP, there are attributes, generalized &quot;set of&quot; &amp; templates in the pipe, along with probably a myriad of loose bits, ends, and minor features!</description>
		<content:encoded><![CDATA[<blockquote cite="#commentbody-2270"><p>
<strong><a href="#comment-2270" rel="nofollow">Stefan Glienke</a> :</strong><br />
Wow! I wonder when you will add full AOP support to DWS
</p></blockquote>
<p>Partial classes were a low-hanging fruit, actually, at some point all class were partial &#8220;courtesy&#8221; of a compiler bug <img src='http://delphitools.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
That said, before AOP, there are attributes, generalized &#8220;set of&#8221; &amp; templates in the pipe, along with probably a myriad of loose bits, ends, and minor features!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Partial Classes in DWScript by Stefan Glienke</title>
		<link>http://delphitools.info/2012/05/14/partial-classes-in-dwscript/comment-page-1/#comment-2270</link>
		<dc:creator>Stefan Glienke</dc:creator>
		<pubDate>Mon, 14 May 2012 09:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1863#comment-2270</guid>
		<description>Wow! I wonder when you will add full AOP support to DWS ;)</description>
		<content:encoded><![CDATA[<p>Wow! I wonder when you will add full AOP support to DWS <img src='http://delphitools.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Helpers added to DWScript by Stefan Glienke</title>
		<link>http://delphitools.info/2012/05/02/helpers-added-to-dwscript/comment-page-1/#comment-2269</link>
		<dc:creator>Stefan Glienke</dc:creator>
		<pubDate>Mon, 14 May 2012 09:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1825#comment-2269</guid>
		<description>&lt;a href=&quot;#comment-2258&quot; rel=&quot;nofollow&quot;&gt;@Eric&lt;/a&gt; 
With delegates Delphi already has that problem that sometimes you have to write the parentheses because otherwise the compiler complains.</description>
		<content:encoded><![CDATA[<p><a href="#comment-2258" rel="nofollow">@Eric</a><br />
With delegates Delphi already has that problem that sometimes you have to write the parentheses because otherwise the compiler complains.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutant records: on methods (and helpers) by Eric</title>
		<link>http://delphitools.info/2012/05/07/mutant-records-on-methods-and-helpers/comment-page-1/#comment-2268</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Fri, 11 May 2012 07:40:01 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1842#comment-2268</guid>
		<description>&lt;a href=&quot;#comment-2267&quot; rel=&quot;nofollow&quot;&gt;@Will Watts&lt;/a&gt; 
If you have a &quot;const record&quot;, then all methods would implicitly be &quot;const&quot;, so &quot;var&quot; would allow in that case to mark particular methods as mutating, and thus taking a &quot;var&quot; param.
Such a &quot;var&quot; method would be restricted, and would error when invoked on a constant or property f.i.</description>
		<content:encoded><![CDATA[<p><a href="#comment-2267" rel="nofollow">@Will Watts</a><br />
If you have a &#8220;const record&#8221;, then all methods would implicitly be &#8220;const&#8221;, so &#8220;var&#8221; would allow in that case to mark particular methods as mutating, and thus taking a &#8220;var&#8221; param.<br />
Such a &#8220;var&#8221; method would be restricted, and would error when invoked on a constant or property f.i.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutant records: on methods (and helpers) by Will Watts</title>
		<link>http://delphitools.info/2012/05/07/mutant-records-on-methods-and-helpers/comment-page-1/#comment-2267</link>
		<dc:creator>Will Watts</dc:creator>
		<pubDate>Thu, 10 May 2012 06:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1842#comment-2267</guid>
		<description>Good spot. It does seem like a pretty big hole, doesn&#039;t it?

As a part time C++ hack, the var modifier seems redundant. As you say, you are bound to interpret
        procedure IncMe; 
as non-const; what does marking it explicitly so bring to the party?</description>
		<content:encoded><![CDATA[<p>Good spot. It does seem like a pretty big hole, doesn&#8217;t it?</p>
<p>As a part time C++ hack, the var modifier seems redundant. As you say, you are bound to interpret<br />
        procedure IncMe;<br />
as non-const; what does marking it explicitly so bring to the party?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutant records: on methods (and helpers) by Eric</title>
		<link>http://delphitools.info/2012/05/07/mutant-records-on-methods-and-helpers/comment-page-1/#comment-2266</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Wed, 09 May 2012 09:33:25 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1842#comment-2266</guid>
		<description>&lt;a href=&quot;#comment-2265&quot; rel=&quot;nofollow&quot;&gt;@Olaf Monien&lt;/a&gt; 
The first issue you describe is that of missing compiler optimizations (there is no reason the compiler can&#039;t use a field of a constant as a constant).

And if you lessen the &quot;const&quot; with assignable constants and allow mutating methods, then you might as well drop the &quot;const&quot; keyword from the language, and use &quot;var&quot; everywhere, because that&#039;s what you end up with...

The language does support constants and immutability, and the compiler does take advantage of it for optimization... except when &quot;records with methods&quot; where introduced, they essentially broke that, and some of the optimizations the compiler *still* does with &quot;const&quot; are essentially invalid.

The current situation is either a combination of oversights when adding features to the language or compiler bugs: you can&#039;t have both the compiler optimize for &quot;const&quot; and have &quot;const&quot; be treated as &quot;var&quot; at the same time...
Some parts of the compiler still properly honor &quot;const&quot;, others don&#039;t.

I don&#039;t think it&#039;s a desirable situation, as basically, you&#039;ve got a half-supported language feature, where you could have a tool to leverage better code quality, and better compiler optimizations.</description>
		<content:encoded><![CDATA[<p><a href="#comment-2265" rel="nofollow">@Olaf Monien</a><br />
The first issue you describe is that of missing compiler optimizations (there is no reason the compiler can&#8217;t use a field of a constant as a constant).</p>
<p>And if you lessen the &#8220;const&#8221; with assignable constants and allow mutating methods, then you might as well drop the &#8220;const&#8221; keyword from the language, and use &#8220;var&#8221; everywhere, because that&#8217;s what you end up with&#8230;</p>
<p>The language does support constants and immutability, and the compiler does take advantage of it for optimization&#8230; except when &#8220;records with methods&#8221; where introduced, they essentially broke that, and some of the optimizations the compiler *still* does with &#8220;const&#8221; are essentially invalid.</p>
<p>The current situation is either a combination of oversights when adding features to the language or compiler bugs: you can&#8217;t have both the compiler optimize for &#8220;const&#8221; and have &#8220;const&#8221; be treated as &#8220;var&#8221; at the same time&#8230;<br />
Some parts of the compiler still properly honor &#8220;const&#8221;, others don&#8217;t.</p>
<p>I don&#8217;t think it&#8217;s a desirable situation, as basically, you&#8217;ve got a half-supported language feature, where you could have a tool to leverage better code quality, and better compiler optimizations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutant records: on methods (and helpers) by Olaf Monien</title>
		<link>http://delphitools.info/2012/05/07/mutant-records-on-methods-and-helpers/comment-page-1/#comment-2265</link>
		<dc:creator>Olaf Monien</dc:creator>
		<pubDate>Tue, 08 May 2012 17:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1842#comment-2265</guid>
		<description>Ok, I have to correct my self: a Record constant would not allow to assign values to it&#039;s fields - unless compiler option &quot;asignable typed constants&quot; is activated. This still doesn&#039;t invalidate my general opinion, that mutability of data structures is something your class/record design should handle and is not a matter of the language....</description>
		<content:encoded><![CDATA[<p>Ok, I have to correct my self: a Record constant would not allow to assign values to it&#8217;s fields &#8211; unless compiler option &#8220;asignable typed constants&#8221; is activated. This still doesn&#8217;t invalidate my general opinion, that mutability of data structures is something your class/record design should handle and is not a matter of the language&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutant records: on methods (and helpers) by Olaf Monien</title>
		<link>http://delphitools.info/2012/05/07/mutant-records-on-methods-and-helpers/comment-page-1/#comment-2264</link>
		<dc:creator>Olaf Monien</dc:creator>
		<pubDate>Tue, 08 May 2012 16:14:49 +0000</pubDate>
		<guid isPermaLink="false">http://delphitools.info/?p=1842#comment-2264</guid>
		<description>I think there has never been a concept of strict immutable  data types in Delphi/Pascal, like it exists for example in Objective-C. 

By defining
  const Olaf: TPerson =(Name : &#039;Olaf&#039;; Age : 43);

&quot;Olaf&quot; becomes a constant as expected, which means that Olaf := Daniel would not compile as expected.
Olaf.Age := 42 would still perfectly be fine - unless you defined &quot;Age&quot; as constant as well. 

In other words &quot;const&quot; never has a meaning for the contents of a container. It only influences the container. This means it is completely up to you, the developer, to decide how a method in a record would work. I would definitely object making &quot;const&quot; somehow influence a method&#039;s behavior.

If you look at Objective-C for example. then you will notice that immutable types wouldn&#039;t expose any &quot;set-like&quot; methods at all, but have constructors for initializing values only - obviously for a reason. This is of course not really a language feature, but more a framework feature.

Regards,
 Olaf</description>
		<content:encoded><![CDATA[<p>I think there has never been a concept of strict immutable  data types in Delphi/Pascal, like it exists for example in Objective-C. </p>
<p>By defining<br />
  const Olaf: TPerson =(Name : &#8216;Olaf&#8217;; Age : 43);</p>
<p>&#8220;Olaf&#8221; becomes a constant as expected, which means that Olaf := Daniel would not compile as expected.<br />
Olaf.Age := 42 would still perfectly be fine &#8211; unless you defined &#8220;Age&#8221; as constant as well. </p>
<p>In other words &#8220;const&#8221; never has a meaning for the contents of a container. It only influences the container. This means it is completely up to you, the developer, to decide how a method in a record would work. I would definitely object making &#8220;const&#8221; somehow influence a method&#8217;s behavior.</p>
<p>If you look at Objective-C for example. then you will notice that immutable types wouldn&#8217;t expose any &#8220;set-like&#8221; methods at all, but have constructors for initializing values only &#8211; obviously for a reason. This is of course not really a language feature, but more a framework feature.</p>
<p>Regards,<br />
 Olaf</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  delphitools.info/comments/feed/ ) in 3.54646 seconds, on May 18th, 2012 at 9:38 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 19th, 2012 at 9:38 am UTC -->
