Feature request - simpler constructors

Derek Parnell derek at psych.ward
Thu Sep 20 07:55:13 PDT 2007


On Thu, 20 Sep 2007 11:05:40 +0100, Janice Caron wrote:

> Please could we let
> 
>  this(auto n) {}
>  T n;
> 
> be syntactic sugar for
> 
>  this(T n)
>  {
>      this.n = n;
>  }
>  T n;

This looks exactly like a problem that AST macros could solve. This is only
one example of a more generic construct, in which the code writer lists a
set of names and each name is used to create an assignment from one
variable to another variable whose name is based on the target variable's
name.


-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list