www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - zip + assocArray problem

The line where aa2 is initialized gets accepted, while the 
initialization of aa5 gets refused, despite in both cases they 
use zipped keys/values from immutable associative arrays:


import std.array: assocArray;
import std.range: zip;
immutable string[const string] aa1, aa2, aa4, aa5;
static this() pure {
     immutable aa3 = ["a":"b"];
     aa2 = aa3.byValue.zip(aa3.byKey).assocArray; // OK
     aa4 = ["a":"b"];
     aa5 = aa4.byValue.zip(aa4.byKey).assocArray; // Error
}
void main() {}


I am missing something or is something wrong?

Bye and thank you,
bearophile
Dec 27 2014