I bought "The D Programming Language" a little while ago. Great book, very educational. However I'm having trouble trying to compile a language feature listed in the book: Extension Functions.
In the book, Andrei writes any function(a, b) can be invoked like: a.function(b); So I should be able to do this:
struct Person {
string name;
}
void foo(Person person, string name) {
person.name = name;
}
void main() {
auto bob = Person();
bob.foo("Bob Dole"); // ERROR: Person does not have method 'foo'
}
Correct? Is this feature not implemented yet, or am I just missing something? I notice that importing std.range adds methods to arrays so it does appear to be implemented at some level.
Just wanted to state, that Uniform Function Call Syntax has been implemented.
There is a nice Dr. Dobbs article about it: Uniform Function Call Syntax on Dr. Dobbs