Feature request - simpler constructors
Steven Schveighoffer
schveiguy at yahoo.com
Thu Sep 20 07:16:36 PDT 2007
"Bill Baxter" wrote
> I like the idea but I'm not wild about the syntax you've chosen. I'd like
> to be able to read off the types of the parameters from the function
> signature without having to dig around in the class for where the memebers
> are defined. What about something like prefixing the name with a dot?
>
>
> this(int .year, int .month, int .day, int .hour, int .minute, int
> .second)
Personally, I like Janice's idea better. It should be up to the IDE to tell
you what the types are for the constructor.
Imagine a situation like this:
class X
{
int y;
this(int .y) {}
}
Now the author decides y should be a long:
class X
{
long y;
this(int .y) {}
}
Oops, forgot to update the constructor. But the compiler won't complain
because this.y = y is valid. With Janice's syntax, this doesn't happen.
-Steve
More information about the Digitalmars-d
mailing list