How do I declare a datatype as an integer range. I'm thinking that this used to be achieved in Rational Rose by entering e.g. { integer = lower 2 | upper 14 } in the class documentation pane.
I was trying to think of a neat way to support this. Current favourite is to add a stereotype, maybe «constraint», on the lines of «access», with associated tags {constrained-type}, {lower} and {upper}.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Release 20130420 implements the idea above (except that {constrains} replaces {constrained-type}).
NB, this implements the constraint by subtyping; the old CF way, {integer=lower 1|upper 5}, translated to
type T is range 1 .. 5;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Aha. I see. In this version, I write a package spec and import from it.
I was trying to think of a neat way to support this. Current favourite is to add a stereotype, maybe «constraint», on the lines of «access», with associated tags {constrained-type}, {lower} and {upper}.
Release 20130420 implements the idea above (except that {constrains} replaces {constrained-type}).
NB, this implements the constraint by subtyping; the old CF way, {integer=lower 1|upper 5}, translated to
I get ...
I think this works as intended.
Last edit: Alex Proudfoot 2013-04-24