--- Comment #5 from 2011-08-24 20:31:58 PDT ---
This is a new part of the design of D purity, and a significant improvement for
D usability.

I think the behaviours shown by this little program are correct, but I think
that error message needs to be improved (completed with more details), because
in some cases (like foo1) that's an acceptable operation:

string foo1() pure {
    const(char[]) s2 = ['a'];
    return s2;
string foo2() pure {
    return ['a'];
string foo3(immutable char[] s) pure {
    return s;
string foo4(in char[] s1, immutable char[] s2) pure {
    return s2;
string foo5(in char[] s) pure {
    return s; // Error: cannot implicitly convert expression (s) of type
const(char[]) to string
void main() {
    immutable r1 = foo1();             // OK
    immutable r2 = foo2();             // OK
    immutable r3 = foo3(['a']);        // OK
    immutable r4 = foo4(['a'], ['b']); // OK
    immutable r5 = foo5(['a']);        // Error

Good and complete error messages are needed to help the programmer understand
her mistake and build a correct model of D semantics in her head.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to