Extend with to take multiple arguments
12345swordy
alexanderheistermann at gmail.com
Thu Jun 6 14:36:57 UTC 2019
On Thursday, 6 June 2019 at 07:22:38 UTC, Simen Kjærås wrote:
> On Thursday, 6 June 2019 at 06:53:00 UTC, Bastiaan Veelo wrote:
>> [...]
>
> First, new Class has different capitalization, so it's not an
> anonymous class like in your code. Second, I believe
> 12345swordy omitted some parts of his intended code, so a more
> correct example would be:
>
> class Class {
> int n;
> string s;
> }
>
> var exp = new Class { n = 4, s = "foo" };
>
> This, D doesn't do. The equivalent would be:
>
> class Class {
> int n;
> string s;
> }
>
> auto exp = new Class();
> with (exp) {
> n = 4;
> s = "foo";
> }
>
> --
> Simen
Exactly, what I meant, thank you Simen.
Alex
More information about the Digitalmars-d
mailing list