3 ms·
I'm absolutely positively in love with "Universal function call syntax" from D, it makes the following: foo.bar(baz) compile to the following if foo has n
by Doxin 8y ago
I'm absolutely positively in love with "Universal function call syntax" from D, it makes the following:
foo.bar(baz)
compile to the following if foo has no property bar:
bar(foo, baz)
It allows you to trivially extend classes from libraries without meddling with their code or breaking other code using the library. e.g. if you define:
string helloWorldize(string input){
return "Hello, "~input;
}
You can then do this anywhere "helloWorldize" is in scope:
"bob".helloWorldize();
And because of the strong type system and smart compiler you'll never run into situations where you call helloWorldize when you don't mean to.