On Wed, 26 May 2010 20:44:50 -0400, retard <r...@tard.com.invalid> wrote:

Thu, 27 May 2010 01:52:32 +0200, Simen kjaeraas wrote:

On Thu, 27 May 2010 01:41:16 +0200, retard <r...@tard.com.invalid> wrote:

Wed, 26 May 2010 22:05:48 +0200, Jacob Carlborg wrote:

I've asked this before, probably several times: if and when will D get
the uniform function call syntax that has been talked about? Example:

void foo (int i) {}
3.foo();

And please don't say it's already implemented because it isn't, I've
heard that before.

Are you sure you're not confusing two things.

"The uniform access says that client code should not be affected by a
decision to implement an attribute as a field or method." -- Programming
in Scala

The other is a term known as extension methods. "Extension methods
enable you to "add" methods to existing types without creating a new
derived type, recompiling, or otherwise modifying the original type."
-- http:// msdn.microsoft.com/en-us/library/bb383977.aspx

http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf

Page 9. The idea is that foo(bar) may be replaced with bar.foo() and
vice versa, making function calls 'uniform' in that both member
functions and free functions may be called in the same manner.

I understood what you meant. It's just that the idea was invented before
in C#. I usually give attribution to (and favor the term invented by) the
original innovator, not the copycat. Those two features have only few
differences, for example C# requires importing the symbols first with
'using'. The proposed D feature is more careless here.

Actually, C# is, if anything, the copycat. (Convergent evolution is much more likely) Extension methods were introduced in C# 3, which was released November 2007. Uniform function call syntax was discussed at D language conference in August 2007. And it's a logical extension from array 'Functions as Array Properties' which has been around since at least 2006.

Reply via email to