[fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

silvioprog silvioprog at gmail.com
Fri Jul 17 16:03:52 CEST 2015


On Fri, Jul 17, 2015 at 3:09 AM, Sven Barth <pascaldragon at googlemail.com>
wrote:

> Am 17.07.2015 08:06 schrieb "Graeme Geldenhuys" <
> mailinglists at geldenhuys.co.uk>:
> >
> > On 2015-07-17 03:34, silvioprog wrote:
> > > TPersonDao = class(TObject)
> > > public
> > >   procedure Save(APerson: TObject);
> > > end;
> >
> > Simply change that to the following:
> >
> > TPersonDao = class(TObject)
> > public
> >   procedure Save(APerson: TPerson);
> > end;
> >
> > and you could have compile time validation too. Using TObject as the
> > parameter type is just too generic (excuse the pun). ;-)
>
> I agree with Graeme here as I thought the same. But maybe the example was
> too simplified and didn't show real reasons for the use of generics?
>
> Regards,
> Sven
>
Yes. Could you send a more nice example explaining some useful reasons of
generics (freepascal\tests\tbf folder)? I think that it could be very
helpful to many programmers. =)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150717/0b27a5b3/attachment.html>


More information about the fpc-pascal mailing list