Re: Template this parameter in constructor

2016-02-26 Thread Vlad Leberstein via Digitalmars-d-learn
On Sunday, 21 February 2016 at 21:48:21 UTC, Steven Schveighoffer wrote: This isn't a bug. Here is what happens. 1. template this is assigned the compile-time type of the object *when the function is called*. 2. A base class constructor is called from the next derived constructor. So C2's c

Re: Template this parameter in constructor

2016-02-21 Thread Ali Çehreli via Digitalmars-d-learn
On 02/21/2016 01:48 PM, Steven Schveighoffer wrote: > So it follows that the template this type will be the next derived > constructor (or the type itself if that is the most derived type), I've just checked: Adding a C4 to the interitance chain (and constructing a C4) confirms that to be the c

Re: Template this parameter in constructor

2016-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/21/16 11:48 AM, Vlad Leberstein wrote: Hi! I'm struggling to use "Template This Parameters" feature(as described in https://dlang.org/spec/template.html#TemplateThisParameter) in class constructor. But it's usage isn't documented very clearly and I'm not even sure if it's supposed to work th

Template this parameter in constructor

2016-02-21 Thread Vlad Leberstein via Digitalmars-d-learn
Hi! I'm struggling to use "Template This Parameters" feature(as described in https://dlang.org/spec/template.html#TemplateThisParameter) in class constructor. But it's usage isn't documented very clearly and I'm not even sure if it's supposed to work this way. Consider the following example: