Re: Ada-Style Sub-Typing

2015-06-06 Thread Charles Hixson via Digitalmars-d-learn
It's not totally convenient, but what I'm currently using is a slightly less elaborate struct: structA {intv;} Since all I'm creating is an isolated type, the private stuff isn't needed. If I wanted to get fancy I could start implementing operations. Comparison is free, as st

Re: Ada-Style Sub-Typing

2015-06-03 Thread via Digitalmars-d-learn
On Tuesday, 2 June 2015 at 21:44:33 UTC, Ali Çehreli wrote: On 06/02/2015 01:16 PM, "Per =?UTF-8?B?Tm9yZGzDtnci?= " wrote: Is there some elegant way of creating "isolated" types in D similar to the semantics of `subtype` in Ada. Correction, this is not subtype but a *derived* type, as ty

Re: Ada-Style Sub-Typing

2015-06-02 Thread Ali Çehreli via Digitalmars-d-learn
On 06/02/2015 01:16 PM, "Per =?UTF-8?B?Tm9yZGzDtnci?= " wrote: Is there some elegant way of creating "isolated" types in D similar to the semantics of `subtype` in Ada. Something like this struct A { this(int value) { this._value = value; } private int _value; alias _value this;

Ada-Style Sub-Typing

2015-06-02 Thread via Digitalmars-d-learn
Is there some elegant way of creating "isolated" types in D similar to the semantics of `subtype` in Ada. Something like this struct A { this(int value) { this._value = value; } private int _value; alias _value this; } struct B { this(int value) { this._value = value; } pri