Rvalue references - The resolution

Walter Bright newshound2 at digitalmars.com
Sat May 4 16:34:04 PDT 2013


On 5/4/2013 4:03 PM, Andrej Mitrovic wrote:
> On 5/4/13, Walter Bright <newshound2 at digitalmars.com> wrote:
>> Andrei & I argued that we needed to make it work with just ref annotations.
>
> So to recap, 2.063 turns slices into r-values which will break code
> that used ref, e.g.:
>
> -----
> void parse(ref int[] arr) { }
>
> void main()
> {
>      int[] arr = [1, 2];
>      parse(arr[]);  // ok in 2.062, error in 2.063
> }
> -----

Do you mean that is an error now with HEAD?


> Then the user might introduce a non-ref overload:
>
> -----
> void parse(ref int[] arr) { }
> void parse(int[] arr) { }  // picks this one
> -----
>
> And later down the road, maybe even in 2.064, ref will take r-values
> making the new code error because of ambiguity between the two
> functions.
>
> Has code breakage ever been taken into account during this dconf conversation?

I don't know of any code it would break.



More information about the Digitalmars-d mailing list