Ex1: TYPE definitions

This forum is for discussing the development of Rel examples and sample applications.
Post Reply
Chris Walton
Posts: 76
Joined: Sat Aug 18, 2012 2:13 pm

Ex1: TYPE definitions

Post 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" ) } };
steved
Posts: 49
Joined: Sun Sep 01, 2013 10:53 pm

Re: Ex1: TYPE definitions

Post by steved »

Hi,

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

thanks,
steve
Post Reply