<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 17, 2015 at 3:06 AM, Graeme Geldenhuys <span dir="ltr"><<a href="mailto:mailinglists@geldenhuys.co.uk" target="_blank">mailinglists@geldenhuys.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>On 2015-07-17 03:34, silvioprog wrote:<br>
> TPersonDao = class(TObject)<br>
> public<br>
>   procedure Save(APerson: TObject);<br>
> end;<br>
<br>
</span>Simply change that to the following:<br>
<br>
TPersonDao = class(TObject)<br>
public<br>
  procedure Save(APerson: TPerson);<br>
end;<br></blockquote><div><br></div><div><div>Yes, it was just a simple and partial demo, but have you seen the following sample in same e-mail that I sent? Using the generics I could do a generic DAO that could be used by any class, avoiding TPersonDAO, TProductDAO, TOtherMyEntityDAO and providing a simple and useful CRUD layer: just specialize it using a model, something like TSession.Persist/Retrieve/Modify/Purge/Paginate<TMyEntity>.</div><div><br></div><div>Generics are very usefeul, the problem is just the way how something it is used in some implementation, e.g, using the FGL AFAIK you cannot know the type of the item from a specializated list class.</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
and you could have compile time validation too. Using TObject as the<br>
parameter type is just too generic (excuse the pun). ;-)</blockquote></div><div class="gmail_extra"><br></div>OK, no problem. =)</div><div class="gmail_extra"><br></div><div class="gmail_extra">BTW I use correct type as parameters, but I believe you understood what I meant. =D<br clear="all"><div><br></div>-- <br><div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>