> On Apr 13, 2018, at 3:29 PM, Marco van de Voort <mar...@stack.nl> wrote: > > Because it is very limited and forces the initialization at the place of > declaration, which is rare if not zero.
When using other languages I use it often. The fact that all other modern languages I’m aware of support it says something also (even c++!). Granted 0 is most common it’s still very helpful to init at time of declaration because you were just going to do it yourself anyways at the start of the scope. It’s such a common pattern but Pascal is out dated on this front. Records don’t have default constructors also like other modern languages so they need some work in my opinion. {$DEFINE TMyRecord_Default := (i: 1; s: 'foo’)} is an interesting idea but unfortunately it’s a bit of a hack. > > p.s. does r:=default(r); do anything ? Or does that only work in generics? I didn’t know Default worked with all types and replaces the more verbose FillChar call. That’s a step in the right direction. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal