[fpc-devel] Parameters must match exactly?

Florian Klaempfl florian at freepascal.org
Mon May 17 23:14:35 CEST 2010


Vinzent Höfler schrieb:
> Florian Klaempfl <florian at freepascal.org>:
> 
>> Graeme Geldenhuys schrieb:
>>
>>> This compiler change will play havoc on the Simple Factory Method design
>>> pattern as well - a base class is used as the parameter type, but
>>> descendants are created and passed back. This is a very common case and
>>> used a lot.
>> ... and one uses normally a function and not a var/out parameter.
> 
> And return the error code in an out parameter instead? Great idea. So readable. So much in the spirit of Pascal.

Doing/allowing unsafe implicit type casts is neither in the spirit of
pascal. When working with modern OOP design methods one uses also modern
error handling mechanisms: exceptions.

> 
> Any more such suggestions on how to write code? Where can one download "Florian's Style Guide" - so one will not do that mistake again?

Maybe you should start with WP:
http://en.wikipedia.org/wiki/Factory_method_pattern
> 
> Sorry for the sarcasm, 

Sarcasm? For sarcasm, you need to have a clue.



More information about the fpc-devel mailing list