Why does the following code behave funny?

void main(){
    string x = " "[1..1];
    writeln(cast(bool)x); // true
    char[] y = [' '][1..1];
    writeln(cast(bool)y); // false
}

Is there any reason for empty arrays to evaluate to true? This is very bug prone.

Reply via email to