Input/Output multiple values from function
Jabari Zakiya
jzakiya at gmail.com
Mon Sep 2 16:02:02 UTC 2019
On Sunday, 1 September 2019 at 20:50:42 UTC, Paul Backus wrote:
> On Sunday, 1 September 2019 at 20:42:28 UTC, Jabari Zakiya
> wrote:
>> It still won't compile, with this error.
>>
>> Error: AliasSeq!(modpg, res_0, restwins, resinvrs) is not an
>> lvalue and cannot be modified
>>
>> Here's a gist of the code.
>>
>> Top functions in code with issues are genPgParameters and
>> selectPG
>>
>> https://gist.github.com/jzakiya/9227e4810e1bd5b4b31e949d1cbd5c5d
>
> You can't do multiple assignments at once using AliasSeq; you
> have to assign each variable individually:
>
> auto parameters = genPgParameters(pg);
> modpg = parameters[0];
> res_0 = parameters[1];
> restwins = parameters[2];
> resinvrs = parameters[3];
There's still are problem When I do this.
auto parameters = genPgParameters(pg);
modpg = parameters[0];
res_0 = parameters[1];
restwins = parameters[2];
resinvrs = parameters[3];
The compiler says this:
Error: cannot implicitly convert expression
parameters.__expand_field_3 of type uint[] to shared(uint[])
If I comment out the last line the programs compiles (and crashes
when run since all the parameters aren't available).
So why does it accept parameter[2] but not [3] as they are both
defined the same?
Is this a compiler bug?
I have to say, getting this simple parameter passing to work in D
has been an infuriating experience. :-(
More information about the Digitalmars-d-learn
mailing list