Am 11.11.2018 um 19:29 schrieb leledumbo via fpc-pascal:
But *if* I had to decide I would pick #1, cause then there wouldn't be
the chance to break existing code if a user decides to add a constructor
to their record and some other code relies on there not being a
constructor. Also due to the syntax
TYPENAME(FIELDNAME:VALUE[;FIELDNAME:VALUE[;…]]) it's in principle
possible to have the parser distinguish whether it's a typecast or a
default constructor.
I would pick #1, too, seems more natural to me. There's no ambiguity as well
thanks to : in the syntax. I do wonder how often this would be used, though.
Despite being idiomatic in many languages, it doesn't really save much
typing that traditional way (if that's the main purpose).
Especially if you're using the same initialization values more often
you'd safe more time by declaring a suitable constant and using that as
the IDE can help you with code completion when using the constant.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal