Ada-Style Sub-Typing

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 3 00:03:20 PDT 2015


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?= 
> <per.nordlow at gmail.com>" 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

     type A is new Integer
     type B is new Integer

in Ada.

See also: 
http://en.wikibooks.org/wiki/Ada_Programming/Type_System#Derived_types


More information about the Digitalmars-d-learn mailing list