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.

Reply via email to