ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0003320 | Part 01: TTCN-3 Core Language | New Feature | public | 06-05-2008 18:49 | 20-12-2008 15:16

Reporter | Gyorgy Rethy |
Assigned To | Ina Schieferdecker |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version | v4.1.1 (published 2009-06) | Fixed in Version | v4.1.1 (published 2009-06) |
Clause Reference(s) | Clause 6 & Annex A
Source (company - Author) | L.M.Ericsson

Summary | 0003320: Introduce contained subtype type constraints

Description

Types in general are sets of values. Subtypes are a limited (related to the parent type) set of values. Today it is allowed to use literals and constants in subtype definitions. However, in several cases, usability of the language would be significantly increased. The new type still shall be a subset of the parent type, but to define it another (even smaller) subsets could be used.
Example:
------------------------------------------------------
Today, to define e.g. types for ISO 8601 date representations, several type definitions has to created in a flat manner, both for atomic and more complex formats; the types for the more complex formats mostly repeating patterns from the other types and patterns tend to grow too huge (n*100 characters). i.e.:
type charstring ISO8601DateCalendarCompleteBasic ( pattern
"{century}({year}{month}{dayOfMonth}")
type charstring ISO8601DateCalendarCompleteExtended ( pattern
"{century}{year}-{month}-{dayOfMonth}")
type charstring ISO8601DateCalendarReducedBasic ( pattern
"{century}({year}(-{month})#(0,1))#(0,1)")
type charstring ISO8601DateCalendarExpandedBasic ( pattern
"{centuryExpansion}{century}({year}(({month}{dayOfMonth})|(-{month}))#(0,1))#(0,1)")
type charstring ISO8601DateCalendarExpandedExtended ( pattern
"{centuryExpansion}{century}{year}-{month}-{dayOfMonth}")
//... further atomic date representations here
//more complex definitions
type charstring ISO8601DateBasic ( pattern
"{centuryExpansion}#(0,1){century}({year}(({month}{dayOfMonth})|({dayOfYear})|({week}({dayOfWeek})#(0,1))|(-{month}))#(0,1))#(0,1)")
type charstring ISO8601DateExtended ( pattern
"{centuryExpansion}#(0,1){century}{year}-(({month}-{dayOfMonth})|({dayOfYear})|({week}(-{dayOfWeek})#(0,1)))")
type charstring ISO8601Date ( pattern
"{centuryExpansion}#(0,1){century}({year}(({month}{dayOfMonth})|({dayOfYear})|({week}({dayOfWeek})#(0,1))|(-(({month}(-{dayOfMonth})#(0,1))|({dayOfYear})|({week}(-{dayOfWeek})#(0,1))))#(0,1))#(0,1))#(0,1)")
------------------------------------------------------
With the use of contained subtypes the structure could become hierarchical that would make complex definitions significantly simpler and without repetitions. This would decrease the development time and probability of errors and increase maintenability (e.g. in case of format changes only the simply types should be changed). i.e.:
type charstring ISO8601DateBasic (
ISO8601DateCalendarCompleteBasic,
ISO8601DateCalendarReducedBasic,
ISO8601DateCalendarExpandedBasic,
//...further atomic types listed here
)
type charstring ISO8601DateExtended (
ISO8601DateCalendarCompleteExtended,
ISO8601DateCalendarExpandedExtended,
//...further atomic types listed here
)
type charstring ISO8601Date (
ISO8601DateBasic,
ISO8601DateExtended
)

Steps To Reproduce |

Additional Information

As contained subtypes represent a subset of the parent type, it would be usable for all types.
From semantical point of view list subtyping and contained subtypes are very similar: the difference is, that the first "lifts" a single value into the new type, the second "lifts" a set of values. Thus, the same subtype mixing rules could be applied as for list subtyping (e.g. can be mixed with other subtyping for integer and float and cannot be mixed for character strings).

Tags | No tags attached.
Relationships |
Attached Files | CR_3320_Introduce_contained_subtype_solution_01.doc (349,184) 29-09-2008 08:24 http://oldforge.etsi.org/mantis/file_download.php?file_id=1661&type=bug CR_3320_Introduce_contained_subtype_solution_02.doc (343,040) 29-09-2008 08:32 http://oldforge.etsi.org/mantis/file_download.php?file_id=1662&type=bug

Issue History
Date Modified | Username | Field | Change
06-05-2008 18:49 | Gyorgy Rethy | New Issue |
06-05-2008 18:49 | Gyorgy Rethy | Status | new => assigned
06-05-2008 18:49 | Gyorgy Rethy | Assigned To | => Ina Schieferdecker
06-05-2008 18:49 | Gyorgy Rethy | Clause Reference(s) | => Clause 6 & Annex A
06-05-2008 18:49 | Gyorgy Rethy | Source (company - Author) | => L.M.Ericsson
09-05-2008 09:39 | Ina Schieferdecker | Target Version | => Edition 4.1.1 (not yet published)
15-07-2008 12:54 | Ina Schieferdecker | Assigned To | Ina Schieferdecker => Thomas DeiÃŸ
29-09-2008 08:24 | Thomas DeiÃŸ | File Added: CR_3320_Introduce_contained_subtype_solution_01.doc |
29-09-2008 08:31 | Thomas DeiÃŸ | Note Added: 0006922 |
29-09-2008 08:31 | Thomas DeiÃŸ | Assigned To | Thomas DeiÃŸ => Gyorgy Rethy
29-09-2008 08:32 | Thomas DeiÃŸ | File Added: CR_3320_Introduce_contained_subtype_solution_02.doc |
18-12-2008 14:58 | Gyorgy Rethy | Note Added: 0007741 |
18-12-2008 14:58 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
18-12-2008 14:58 | Gyorgy Rethy | Status | assigned => resolved
18-12-2008 14:58 | Gyorgy Rethy | Resolution | open => fixed
18-12-2008 14:58 | Gyorgy Rethy | Fixed in Version | => Edition 4.1.1 (not yet published)
20-12-2008 15:16 | Ina Schieferdecker | Status | resolved => closed

Notes

(0006922)
Thomas DeiÃŸ
29-09-2008 08:31

Example in CR (charstrings) can be written by defining corresponding templates first and then using pattern subtyping of charstrings. This is possible only for charstrings, this kind of subtyping would be reasonable for other types, too. Solution proposal uploaded for checking. (version 02 contains also rules on mixing subtyping)

(0007741)
Gyorgy Rethy
18-12-2008 14:58

OK with me.