|
In many applications there are sorts which only differ in minor aspects from other sorts, but which are basically constructed in a similar way. In this case a partial type description can be parameterised. Parameterised types are very useful if types like sets, fields or queues are used. A set is usually a set of element of a certain type. The properties of the set are fairly independent of the type of the elements it contains. Without the possibility of parameterisation, every set of elements of a certain type has to be specified separately. The following example is a partial type description for a set containing integer numbers. Integer is a predefined sort in SDL.
Sets can be formed with other types of elements, but the basic construction of the set is the same
Obviously, these two descriptions above are almost identical and only differ in the imported sorts Integer or Real. To avoid repetition of text, the user can define a class of parameterised sorts by using the generator construct of SDL.
The description is supplied with the formal parameter element now and can be actualized with any sort
Note: In SDL-92, parameterised types were introduced in general, but for data types the GENERATOR construct was retained. However, in SDL-2000, the parameterisation of all types was harmonised, and therefore the specific GENERATOR construct for data types was dropped. |
Contact the webmaster with
questions or comments about this web site. |