April 22, 2014
On Tue, 22 Apr 2014 14:50:44 -0400, monarch_dodra <monarchdodra@gmail.com> wrote:

> On Tuesday, 22 April 2014 at 18:35:58 UTC, Steven Schveighoffer wrote:
>> On Tue, 22 Apr 2014 11:36:07 -0400, monarch_dodra <monarchdodra@gmail.com> wrote:
>>
>>> On Tuesday, 22 April 2014 at 15:30:36 UTC, Steven Schveighoffer wrote:
>>>> Also, an immutable can be initialized that way:
>>>>
>>>> immutable int[] = int[].init;
>>>
>>> Isn't that exactly "R.init" ?
>>
>> Yes, you said if it's an immutable it would fail to compile. I think this is not true.
>>
>> -Steve
>
>
> Ah... you said:
>
>> Note, is the r2 = R.init needed? Not sure.
>
> To whitch I replied:
>
>> Yes: It R2 has no default init, or is an immutable,
>> then that line will fail to compile.
>
> I meant that if you *don't* add the R.init, then the code will *not* compile. EG => R.init is necessary.
>
> Sorry for the mixup :/

OH!!! I meant is the whole *line* necessary, not the R.init part :)

Note that in my updated version, r is passed in as a parameter to the mock function. This means if R is inout(something), it will be part of the parameters, and you don't need a dummy inout parameter to shut the compiler up.

So the r2 = R.init; was just to "keep things the same", but I'm not sure it's necessary to have. It has a comment saying "can define a range object", whereas it could just be "I need a range object to compile the rest of this code" :)

-Steve
1 2
Next ›   Last »