On 11/04/10 16:01, Robert Clipsham wrote:
When using your method, you have to use:
----
each!(array, typeof(array))((int item) {writefln("%d", item+b)});
----
(I believe this is a bug, dmd should be able to deduce the type here).
As for the syntax, you can do this with any function in D:
----
void foo(int a) { writefln( "%d", a ); }
/// Prints 1
foo = 1;
----
I didn't realize this worked for free functions, apparently it does. I
think in newer versions of D2 functions like this will have to be marked
with @property, I don't think dmd currently enforces this though.

When I tried again, your method worked... odd, I must have done something wrong before.

Reply via email to