Revised RFC on range design for D2

Sergey Gromov snake.scaly at gmail.com
Thu Sep 25 14:19:46 PDT 2008


In article <gbgu0h$5sq$1 at digitalmars.com>, SeeWebsiteForEmail at erdani.org 
says...
> Sergey Gromov wrote:
> > I think that property function call feature in general adds an 
> > unnecessary ambiguity to the language.  I'd prefer functions to be 
> > callable only with regular function call syntax, and properties be 
> > usable only with member access syntax.  The same stands for 'unified 
> > function call' feature: if you want to inject a method into an 'array of 
> > chars' class you do so explicitly, and only the member call syntax is 
> > allowed on that method.  Otherwise code tends to become ambiguous and 
> > unreadable.
> 
> Experience with other languages has shown that using identical syntax 
> for genuine member access and member function access helps 
> maintainability because it allows a type implementer to switch back and 
> forth between implementing a property as a direct member or as a 
> function, transparently to that type's use.

Sorry I may have been unclear.  I'm not against interchangeability 
between properties and property accessor methods.  I'm against using 
property accessors as methods, and against using methods as if they were 
property accessors.  The current situation actually breaks 
maintainability because after somebody used .length() you cannot replace 
it with a public variable anymore.  And you cannot replace

public void delegate(int) foo;

with an accessor method because the code 'instance.foo();' will stop 
working as it used to.


More information about the Digitalmars-d-announce mailing list