www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Inconsistent 'field' syntax?

Having to use the explicit call syntax (with the ()'s) for top level functions
with an array for the first parameter seems to be inconsistent with how other
aggregate 'fields' are treated.

(dmd v0.145)

import std.stdio, std.string;
void main()
{
char[] str = "ABCDEF";
MyString ms = new MyString(str);
writefln(str.lowercase);   // "no property 'lowercase' for type 'char[]'"
writefln(str.lowercase()); // OK
writefln(ms.lowercase);
}

class MyString
{
char[] str;
this(char[] s) { str = s.dup; }
char[] lowercase() { return tolower(str); }
}

char[] lowercase(char[] str)
{
return tolower(str);
}
Jan 29 2006