﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <description><![CDATA[Comments for Templates in Object Pascal]]></description>
    <title><![CDATA[Comments for Templates in Object Pascal]]></title>
    <link>http://edn.embarcadero.com/article/27603</link>
    <!-- source: http://edn.embarcadero.com/article/27603/feed-->
    <dc:date>2009-11-08T01:26:46-08:00</dc:date>
    <item>
      <description><![CDATA[Best way is start with ready to use libraries. Delphi 2009 comes with some (only few actually) templates, but they are compatible only with Delphi 2009.Some good libraries of data structures / containers for Delphi:- RBS AntiDOT (http://redbeesoft.com or http://sourceforge.net/projects/adot)- DeCAL (http://sourceforge.net/projects/decal/)]]></description>
      <title><![CDATA[Templates in Object Pascal]]></title>
      <managingEditor>
	 (andrew galatyn)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=42165</guid>
      <dc:date>2009-02-17T06:27:19-08:00</dc:date>
      <pubDate>2009-02-17T06:27:19-08:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[Hi,The article mentioned in my previous post is now also available in English:http://www.dummzeuch.de/delphi/object_pascal_templates/english.htmltwm]]></description>
      <title><![CDATA[The article is also available in English now]]></title>
      <managingEditor>
	 (Thomas Mueller)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=38545</guid>
      <dc:date>2005-07-16T05:42:53-07:00</dc:date>
      <pubDate>2005-07-16T05:42:53-07:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[You tell us how to use the Vector interface, but not Collection class template.How do you create/initialize the Collection Class template to add new items to it?]]></description>
      <title><![CDATA[Templates in Object Pascal]]></title>
      <managingEditor>
	 (Craven Weasel)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=38085</guid>
      <dc:date>2005-01-17T19:05:58-08:00</dc:date>
      <pubDate>2005-01-17T19:05:58-08:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[&gt; If you want to see an example, visit http://www.dummzeuch.de&gt; (The article is in German only, but the code examples should&gt; be easy to understand.)Just in case anybody is still interested: I have translated my article to English now.twm]]></description>
      <title><![CDATA[re: One include file is enough]]></title>
      <managingEditor>
	 (Thomas Mueller)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=34724</guid>
      <dc:date>2003-05-31T10:20:48-07:00</dc:date>
      <pubDate>2003-05-31T10:20:48-07:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[FYI, too, it is possible to use interfaces with these Object Pascal templates as well.  It all hinges on syntax I previously didn't know Delphi supported.You can declare an interface as:  _ITERATOR_INTF_ = interface    ['{9F522A03-F6AC-11D6-9250-0004AC5359AE}']    function Next: _ITEM_;  end;Putting this in the templates will of course cause problems, as all interface GUIDs need to be unique, so if you use the template more than once, you'll run into trouble.However, there's another way to declare an interface:const  _ITERATOR_INTF_IID_ = '{9F522A03-F6AC-11D6-9250-0004AC5359AE}';type  _ITERATOR_INTF_ = interface    [_ITERATOR_INTF_]    function Next: _ITEM_;  end;This means that the IID can be defined elsewhere, such as the unit that uses the include files.  So, in my interface section, I can put in the section:const  _ITERATORREFS_IID_ = '{9F522A02-F6AC-11D6-9250-0004AC5359AE}';  _ITERATOR_IID_ = '{9F522A03-F6AC-11D6-9250-0004AC5359AE}';  _ITERABLELIST_IID_ = '{9F522A04-F6AC-11D6-9250-0004AC5359AE}';type  _ITEM_ = ICOREListener;  {$INCLUDE GIterableList.inc}  TCOREListenerList = _ITERABLELIST_;  TCOREListenerListIterator = _ITERATOR_;  ICOREListenerList = _ITERABLELIST_INTF_;  ICOREListenerListIterator = _ITERATOR_INTF_;A little more work than an object list, but works great!- Ritchie Annandhttp://members.shaw.ca/nimble]]></description>
      <title><![CDATA[Interfaces with templates in Object Pascal]]></title>
      <managingEditor>
	 (Ritchie Annand)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=33532</guid>
      <dc:date>2002-11-14T13:05:16-08:00</dc:date>
      <pubDate>2002-11-14T13:05:16-08:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[I used to use smart pointers in C++ as well (VisualAge/C++) - one thing they were not good at (and that we implemented various template schemes to get around) was circular references, which is a trouble you get in any reference-counting scheme (including TInterfacedObject with interfaces in Delphi :)  We made an 'anchor_ptr&lt;&gt;' which would act as the one external reference to the circularly-referenced object group, which worked most of the time, but... oh, what a pleasure to debug :)I'm going to assign myself the task of figuring out the internals of garbage collectors to see how they handle and track the dependency trees to get rid of circularly-dependent objects.Thierry made mention of Ada generics, and I would agree that they would make a much more appropriate addition to Delphi than C++-style templates would.  With Ada generics, you create the equivalent of a unit (a 'package') which is termed a 'generic', and contains the named, substitutable type information in the header of the generic (like Stack_Item, Stack_Size, etc.)When it comes time to *use* it, you declare a new package from the generic, e.g.  package Integer_Stack is new Stack(Integer);Integer_Stack is now available as a class for you to use. I like its explicit nature, both in terms of type information and dependencies.The C++ ones, by contrast, seem to crack the way the language works (at least from a compiling/linking point of view) by having templates generate at point of use (which isn't a great spot to inline the generated template class code :)The error codes that templates used to generate - especially at link time - ouch :)Loki - is that the company making all those Linux translations of things like Sim City 3000?  Saw those at a CUUG open house here - looked interesting :)]]></description>
      <title><![CDATA[re: Templates in Object Pascal]]></title>
      <managingEditor>
	 (Ritchie Annand)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=33531</guid>
      <dc:date>2002-11-14T12:59:35-08:00</dc:date>
      <pubDate>2002-11-14T12:59:35-08:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[&gt; Very interesting idea. A bit more preprocessor stuff lets&gt; you include the same file twice:&gt; {$IFNDEF SECOND_PASS}&gt; // interface&gt; ...&gt; {$DEFINE SECOND_PASS}&gt; {$ELSE}&gt; // implementation&gt; ...&gt; {$ENDIF}&gt; Since there is a limit of one such class to a unit anyway&gt; and unit defines go out of scope, there is no need for&gt; $UNDEF either.You can even go one step further by adding some more ifdefs: You can start with a normal unit, with header, uses clauses etc. Just use it as a normal unit in a test program until you are sure the template works as expected.Then you put some additional ifdefs around the header, uses clauses etc. and bang, you get your includeable template, which can still be used as a normal unit in case there is a bug.If you want to see an example, visit http://www.dummzeuch.de (The article is in German only, but the code examples should be easy to understand.)MfG :-)Thomas]]></description>
      <title><![CDATA[re: One include file is enough]]></title>
      <managingEditor>
	 (Thomas Mueller)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=33082</guid>
      <dc:date>2002-09-07T12:56:57-07:00</dc:date>
      <pubDate>2002-09-07T12:56:57-07:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[Sorry if I've misunderstood you:"That is to say you can't step through the code in the include files. "but with D6 I can step through include filesBest regardsDietmar]]></description>
      <title><![CDATA[re: Templates in Object Pascal]]></title>
      <managingEditor>
	 (Dietmar Brueckmann)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=32732</guid>
      <dc:date>2002-07-22T06:59:05-07:00</dc:date>
      <pubDate>2002-07-22T06:59:05-07:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[&lt;this message deleted&gt;]]></description>
      <title><![CDATA[&lt;this message deleted&gt;]]></title>
      <managingEditor>
	 (Clinton Johnson)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=30180</guid>
      <dc:date>2002-02-21T02:33:07-08:00</dc:date>
      <pubDate>2002-02-21T02:33:07-08:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <item>
      <description><![CDATA[I wouldn't compare C++ smart pointers with a reference based PL using a grabage collector such as Java: GCs are supossed to explore the whole graph of dependencies amongst instances, so they can detect cycles in it and safely remove all the instances involved when no other external instance references any of them. C++ smart pointers haven't that wide scope, they just garantee the persistance of the instance they hold, and are completely unaware of instance dependencies. Obviously they are much more efficient, but don't overcome the same problems that GCs do.]]></description>
      <title><![CDATA[re: Templates in Object Pascal]]></title>
      <managingEditor>
	 (Tony Sanchez)
</managingEditor>
      <guid isPermaLink="true">http://threads.embarcadero.com/threads/threads.exe/view?commentid=30335</guid>
      <dc:date>2001-10-22T04:09:31-07:00</dc:date>
      <pubDate>2001-10-22T04:09:31-07:00</pubDate>
      <source url="http://edn.embarcadero.com/article/27603/feed">Comments for Templates in Object Pascal</source>
    </item>
    <generator>Atom 1.0 XSLT Transform v1 (http://atom.geekhood.net)</generator>
  </channel>
</rss>