Feature request - simpler constructors

Yigal Chripun yigal100 at gmail.com
Fri Sep 21 05:33:57 PDT 2007


Janice Caron wrote:
> On 9/21/07, kris <foo at bar.com> wrote:
>> Here's a thought for everyone to consider. Please take a look at a large
>> and /practical/ body of code, written in D, by capable programmers, and
>> actually count the number of times this would even be applied?
> 
> Are you saying it's /rare/ to assign a member variable from a
> constructor parameter?
> 
> Or are you just saying it's rare to use the "this.x" notation. I know
> I usually give my member variables different names from parameter
> names to avoid having to do that. I don't have a large body of D to
> look at, but I certainly see
> 
> T(U x_, V y_) : x(x_), y(y_) {}
> 
> a lot in C++ (as well as initialisation by assignment within the
> constructor body, by less experienced programmers).

IMHO kris is right regarding this idea.
we should try to keep the size of the language to a minimum and not add 
  unnecessary language constructs just for the sake of it.
each such feature complicates the language and makes D that much more 
difficult to learn.
this thread already contains an implementation of such a construct using 
existing language features and when D gets macros everyone could add 
whatever she wants to the language just like you do with Java annotations.



More information about the Digitalmars-d mailing list