Subtypes with tighter constraints

Victor Porton porton at narod.ru
Tue Jan 1 14:05:43 UTC 2019


In Ada2012 there are "subtypes". Subtypes can have tighter 
constraints (such as type invariants) than their base types.

I have a struct X in D. Is it possible to define a type 
equivalent to X except that having tighter invariants?

As I understand if I derive Y from X, then it is no more X; that 
is I cannot use X (even provided it matches Y invariants) where I 
need Y. So in D it is impossible, right?

I think in D it's impossible, but want to be sure and so ask.



More information about the Digitalmars-d-learn mailing list