[fpc-devel] class abstract, class sealed implementation. please review.

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Oct 19 09:15:26 CEST 2009


On 19/10/2009, Florian Klaempfl <florian at freepascal.org> wrote:
>
> Without discussing details, I think a singleton is a good example where
>  sealed is useful.


You had to go and pick the one design pattern that is probably the
most difficult to implement (per GoF book) in any language. :-)

There are various other ways to implement Singleton in Object Pascal.
For years I have had a singleton implementation that you cannot create
instances from, except one global function that return the very first
(and only) instance.

So even without "sealed" support, Singleton is possible, but yes that
is probably the best (and only) use I can see for 'sealed'. So adding
a language feature for only one specific design pattern seems a bit
over the top.


By I guess this whole thread got taken over by the "sealed"
discussion. I'm pretty sure, through all this, Paul is still waiting
on a definite answer of: is my patch ok?

Irrespective if developers should/shouldn't use 'sealed'? I guess that
answer can only be decided by the developers preference to OOD & OOP.
Just like there are many other language features in Object Pascal I
will never use - "label & goto" come to mind. :)


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list