[fpc-devel] Parameters must match exactly?

"Vinzent Höfler" JeLlyFish.software at gmx.net
Tue May 18 15:28:46 CEST 2010


Florian Klaempfl <florian at freepascal.org>:

> Nobody doubts this, this is also why I wrote "normally" in my initial
> post. Nevertheless I didn't see a single valid reason yet why
> implementing the factory method pattern cannot be done using a function:
> - it is one of the basic programming principles: if a result is returned
> by a subroutine, use a function
> - it makes things more intuitive to read because it looks like a
> constructor
> 
> If you really want to use a var-parameter, insert an explicit typecast
> then everybody knows: "this code is dangerous, we have to keep an eye on
> it".

With the example you gave (see my answer), the typecast would be necessary as well when using a function. And it would also be wrong in precisely the same way.


Vinzent.

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the fpc-devel mailing list