[fpc-devel] type discussion

Vinzent Hoefler JeLlyFish.software at gmx.net
Thu Jun 2 17:28:38 CEST 2005


On Thursday 02 June 2005 15:16, Uberto Barbini wrote:

> If the goal is this, I'd prefear a way to declare objects
> autocreated:
>
> varauto:
>   strlist: TStringList;
> begin
>   //some stuff
> end;

[...]
>
> It could be a problem to pass parameters to the constructor.

Yes, exactly. So why bother the extra complexity? You still need the 
"real thing", so for consistency it's better to stay with it only.

Something like this you can see in Java: In the constructor of a derived 
class you always need to call the constructor of the base class in the 
first place. So, to "simplify" the task, the compiler does the magic 
for you, if there is a "default" constructor that has no parameters. 
Great. But the virtually same code just does not compile when there is 
no such thing as a parameterless constructor and you keep asking you 
why it does not f***ing compile. Until you read the 500 pages of the 
JLS and then *know* that the compiler does stupidly magic tricks for 
you. It can even become much more confusing if you have more than a 
single constructor.

I don't think, this makes anything easier, less error-prone, whatever. 
It just confuses people.


Vinzent.

-- 
public key: http://www.t-domaingrabbing.ch/publickey.asc





More information about the fpc-devel mailing list