www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Uniform function call syntax

reply Jacob Carlborg <doob me.com> writes:
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.

-- 
/Jacob Carlborg
May 26 2010
next sibling parent reply retard <re tard.com.invalid> writes:
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
May 26 2010
next sibling parent reply "Simen kjaeraas" <simen.kjaras gmail.com> writes:
On Thu, 27 May 2010 01:41:16 +0200, retard <re 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 ge=
t
 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 =EF=AC=81eld or method." -- Pr=
ogramming
 in Scala

 The other is a term known as extension methods. "Extension methods ena=
ble
 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 vic= e versa, making function calls 'uniform' in that both member functions and= free functions may be called in the same manner. -- = Simen
May 26 2010
next sibling parent reply retard <re tard.com.invalid> writes:
Thu, 27 May 2010 01:52:32 +0200, Simen kjaeraas wrote:

 On Thu, 27 May 2010 01:41:16 +0200, retard <re 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 original innovator, not the copycat. Those two features have only few 'using'. The proposed D feature is more careless here.
May 26 2010
parent reply "Robert Jacques" <sandford jhu.edu> writes:
On Wed, 26 May 2010 20:44:50 -0400, retard <re 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 <re 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 original innovator, not the copycat. Those two features have only few 'using'. The proposed D feature is more careless here.
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.
May 26 2010
parent retard <re tard.com.invalid> writes:
Wed, 26 May 2010 21:43:38 -0400, Robert Jacques wrote:

 On Wed, 26 May 2010 20:44:50 -0400, retard <re 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 <re 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 invented by) the original innovator, not the copycat. Those two the symbols first with 'using'. The proposed D feature is more careless here.
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.
in "modern" programming languages were already invented 20-50 years ago. reinvented it.
May 27 2010
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2010-05-27 01.52, Simen kjaeraas wrote:
 On Thu, 27 May 2010 01:41:16 +0200, retard <re 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.
What he said ^ -- /Jacob Carlborg
May 27 2010
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2010-05-27 01.41, retard 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
This was talked about at the first D conference and the term used there was "uniform/unified function call syntax". -- /Jacob Carlborg
May 27 2010
prev sibling parent reply "Robert Jacques" <sandford jhu.edu> writes:
On Wed, 26 May 2010 16:05:48 -0400, Jacob Carlborg <doob me.com> 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.
Is your patch still current or does it need to be looked at? (http://d.puremagic.com/issues/show_bug.cgi?id=3382)
May 26 2010
parent Jacob Carlborg <doob me.com> writes:
On 2010-05-27 07.17, Robert Jacques wrote:
 On Wed, 26 May 2010 16:05:48 -0400, Jacob Carlborg <doob me.com> 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.
Is your patch still current or does it need to be looked at? (http://d.puremagic.com/issues/show_bug.cgi?id=3382)
1. I assume that the line numbers in the diff is not correct anymore, don't know how sensitive that is 2. As I say in the bug report literals don't work, i.e. 3.foo();, x.foo(); works though. To make 2. work I assume additional changes need to made in the lexer and/or parser. What I've heard 2. will never work until ".1" and/or "1." are not allowed anymore. -- /Jacob Carlborg
May 27 2010