A new class -->String

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Thu Apr 5 01:35:46 PDT 2007


David B. Held wrote:
> Jari-Matti Mäkelä wrote:
>> David B. Held wrote:
>>> If there were a way to switch between method call and free
>>> function syntax, then this distinction would become moot (and maybe we
>>> will get that as well...).

>> D has that already :)

> Well, it isn't general:
> 
> void foo(int x) { int y = x; }
> 
> unittest
> {
>     int z = 5;
>     z.foo();
> }
> 
> test.d(43): Error: no property 'foo' for type 'int'
> test.d(43): Error: function expected before (), not 1 of type int

Hm, I wonder if that's a compiler bug. I have not used this feature
recently, but I recall it used to work. I even have bindings where this
feature is used to provide an alternative syntax for a wrapper class.
Now that I tested it, it only seems to work with arrays and AAs anymore.
But it's still enough to implement those string functions though.



More information about the Digitalmars-d mailing list