[fpc-pascal] Default record fields
Ryan Joseph
ryan at thealchemistguild.com
Fri Jun 22 07:57:21 CEST 2018
I want to do a pivot away from the macro stuff to ask another question. Since I’ve wanted to contribute to the compiler for so long and I finally have a little understanding I’d like to know if there’s anything minor I could do, that isn’t offensive to the compiler team.
What comes to mind first as being minor (or not, I don’t know) and important are default record fields. Is there are reason this never existed in Pascal? It’s in C++, C#, Swift etc…. and I use it often. The compiler added advanced records but making a static class method which is hidden down in the implementation is annoying boiler plate I’m sick of doing (plus calling it, or forgetting to). The new initialize operator is the best alternative but again it’s boiler plate and adds methods in the implementation.
Is there any reason we can’t do that? Is it a design choice?
type
TVec2 = record
x: integer = 0;
y: integer = 0;
end;
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list