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

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Fri Jul 17 16:24:16 CEST 2015


On 2015-07-17 15:08, silvioprog wrote:
> 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


I fully appreciate that there could be some uses, but I don't agree it
makes the language any better - in the contrary, it makes it much harder
to read. Pascal used to pride itself by being an easy to read and
understand language [by a human].

As for you DAO example. It comes down to what Michael said - more
frameworks need to be created. eg: I use the tiOPF framework for all
data persistence and more. I can simply call MyPerson.Save or
MyProduct.Save and the framework takes care of everything for me (CRUD,
transactions, object ID's etc). I can even switch between database
systems, database components or even to a 3-tier system without changing
a single line of code in my software. Simply change a compiler define in
the Project Settings and recompile my project. All without generics. ;-)

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/



More information about the fpc-pascal mailing list