Upgrading a codebase from 2.065 to 2.066
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 2 15:50:21 PDT 2014
Brian Schott:
> I recently upgraded EMSI's internal data processing library[1]
> so that it will be compatible with the upcoming 2.066 release
> and thought it might be useful to share my experience.
I suggest to update large programs more frequently than adjacent
compiler versions, because there is too much changed stuff.
> 5. A change to object.d broke a line of code that used "[]" as
> the "defaultValue" argument to the get() function for AAs.
> Casting "[]" to the expected type worked around this issue.
Indeed this doesn't compile, but perhaps it should:
void main() {
int[][int] aa;
int[] r = aa.get(0, []);
}
A current workaround (but it's not DRY, because 'aa' is repeated
twice):
void main() {
import std.traits: ValueType;
int[][int] aa;
int[] r = aa.get(0, ValueType!(typeof(aa)).init);
}
Bye,
bearophile
More information about the Digitalmars-d
mailing list