For my link archive.
Full text at: [WayBack] … why the Delphi language does not allow parameterless constructors… – David Heffernan – Google+
Abstract:
+Stefan Glienke deleted his post about parameterless record constructors, presumably due to all the off topic comments.
…
.net at CLR level does allow parameterless constructors on structs. But the C# language bans them: https://msdn.microsoft.com/en-us/library/saxz13w4.aspx
Jon Skeet posted an answer on SO way back in 2008 on this topic: http://stackoverflow.com/a/333840/ From that answer:
—-
The CLR allows value types to have parameterless constructors, but C# doesn’t. I believe this is because it would introduce an expectation that the constructor would be called when it wouldn’t. For instance, consider this:MyStruct[] foo = new MyStruct[1000];
…
—-My guess is that Embarcadero decided to ban parameterless constructors on Delphi records for the same reason. Or perhaps they just copied the rules from C# without realising that the CLR supported parameterless struct constructors.
References:
- [WayBack] Why can’t I define a default constructor for a struct in .NET?
- [WayBack] Structs (C# Programming Guide)
- [WayBack] Restore requirement for struct constructors to always have formal parameters. #1029
–jeroen