[Swift-devel] Feature proposal: struct constructors
Mihael Hategan
hategan at mcs.anl.gov
Wed Feb 4 12:56:39 CST 2015
I like the general idea of struct constructors and I am for it.
I also think that I like keyword arguments to struct constructors.
Presumably there could be cases when you don't want to initialize all
fields of a struct.
Also, we should probably encourage a naming convention that avoids
possible conflicts between function invocations and struct constructors.
Using capitalized names for user-defined types comes to mind.
Mihael
On Wed, 2015-02-04 at 11:39 -0600, Justin M Wozniak wrote:
> Did we discuss optional or named parameters wrt constructors?
>
> type v {
> int x = 0;
> int y = 0;
> }
>
> e2 = v(y=1);
>
> On 02/04/2015 11:14 AM, Tim Armstrong wrote:
> > type foo {
> > int x;
> > int y;
> > }
> >
> > foo bar;
> > bar.x = 1;
> > bar.y = 2;
>
>
More information about the Swift-devel
mailing list