[fpc-devel] class abstract, class sealed implementation. please review.
Florian Klaempfl
florian at freepascal.org
Mon Oct 19 09:35:23 CEST 2009
Graeme Geldenhuys schrieb:
> 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.
After all there are a couple of reasons to add it
- Delphi compatibility
- at least the singleton pattern
- commercial packages
- possible optimization without wpo
And taking into account the size of the patch (see below and ignore the
auto generated files msg*.inc), it's worth to add. private etc. cause
much more trouble in the compiler and has no more real use imo.
>
>
> 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?
See
http://github.com/graemeg/freepascal/commit/6d0dc36b82ba90403594f00bdd96a36b5b820f66
;)
More information about the fpc-devel
mailing list