Page 1 of 1

Ex1: TYPE definitions

Posted: Sat Jul 27, 2013 9:02 pm
by Chris Walton
Simplest type

Code: Select all

TYPE data_type POSSREP { value CHAR };
Inheritance from built-in type

Code: Select all

TYPE Ntest2 IS { INTEGER  CONSTRAINT INTEGER < 10 };
Union type

Code: Select all

TYPE data_type UNION;
Union type with own possrep

Code: Select all

TYPE data_type UNION POSSREP { domain ID, name ID, T ID };
Specialisation by constraint

Code: Select all

TYPE art IS { data_type POSSREP { T ID CONSTRAINT THE_VALUE ( T ) = "art" } };
Inheritance by extension

Code: Select all

TYPE two IS { data_type POSSREP { T ID } };
Subtypes of a union type

Code: Select all

TYPE arbitrary_defn IS { data_type POSSREP { 
  domain ID, name ID, T ID CONSTRAINT  THE_T ( T ) = ID ( "arbitrary_defn" ) } };
TYPE boolean_defn IS { data_type POSSREP {
  domain ID, name ID, T ID CONSTRAINT  THE_T ( T ) = ID ( "boolean_defn" ) } };

Re: Ex1: TYPE definitions

Posted: Sat Mar 14, 2015 12:15 am
by steved
Hi,

I'm just starting to explore user defined types in Rel. I found these
examples helpful.

thanks,
steve