[fpc-pascal] Uniform initialization?

Ryan Joseph ryan at thealchemistguild.com
Mon Nov 12 12:49:08 CET 2018



> On Nov 12, 2018, at 1:55 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> That is a constructor that takes no arguments. How do you think that is useful for a constructor that *does* take arguments? That is absolutely not clear at all for the user. 

I just meant as a label so you know the record has a default constructor associated with it and it’s named. You’re right about the fields changing place and breaking constructors.

Honestly if the syntax is the type cast I probably would just make a constructor anyways because it’s less typing in the end. What I was really after is a way to save time making boiler plate constructers for records that merely hook up params to fields.

It feels like this is in the sprite of what properties aimed to accomplished, i.e. making getting/setters easier to manage.

Given that is there any syntax based off properties you would accept? Otherwise probably best to let this one rest. 

I managed to get the syntax parsed for the type cast but not sure how to build the nodes or if it should point to a hidden constructor (lots of overhead in that case). Maybe I’ll come back to that later.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list