January 30, 2006 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); } |
Copyright © 1999-2021 by the D Language Foundation