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

ID | Project | Category | View Status | Date Submitted | Last Update
0002975 | Part 01: TTCN-3 Core Language | New Feature | public | 04-03-2008 10:01 | 24-04-2008 19:06

Reporter | user324 |
Assigned To | Ina Schieferdecker |
Priority | normal | Severity | major | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version | v3.4.1 (published 2008-09) | Fixed in Version | v3.4.1 (published 2008-09) |
Clause Reference(s) | A.1.6.5, A.1.6.1.4, 11.2, 5.4.1.2, 16.1
Source (company - Author) | Testing Technologies - Jacob Wieland

Summary | 0002975: Allow specification of non-optional templates

Description

At the moment, it is not possible to declare a template parameter, template variable or template return type in such a way that it describes only templates which do not match the special value 'omit', i.e. templates which can only be used for non-optional fields.
Since expressions containing matching mechanisms can only be passed to parameters with a template modifier, the type 'template T' must, at the moment be interpreted as: all expressions of type T which match values of type T or the value 'omit', so that they can be used to be assigned to optional fields. However, since there is no way to say that an arbitrary template expression does _not_ match 'omit', a compiler needs to produce a warning whenever a template parameter (or template variable or template return value) is assigned to a non-optional field, since this can lead to a runtime-error. Static checking to avoid this situation is nearly impossible and at best takes a very high computational effort (for a small gain).
Therefore, the following solution is proposed to enhance the expressivity of the
TTCN-3 type language:
Allow the keyword 'ispresent' to be put (optionally) behind every occurrence of the keyword 'template'. The semantics of the type 'template ispresent T' would be all expressions of type T which do not match the special vaule 'omit'. This would mean that such a template can be safely used in an assignment to a non-optional field. Also, each non-optional field of a template would automatically have the type 'template ispresent T', if the field was declared as of type T.
As far as I can see, the following rules have to be changed in the BNF in
the following way:
- TemplateRestriction ::= "(" OmitKeyword ")" | IsPresentKeyword
- PreDefFunctionIdentifier ::= Identifier | IsPresentKeyword
and one new rule introduced:
- IsPresentKeyword ::= "ispresent"
This approach would have the advantage that no new identifier needs to be reserved, causing minimal backward compatibility issues for old Testsuites, their semantics would stay unchanged.
Alternatively, I would propose the new keyword 'present' instead of using 'ispresent'. This would have the drawback that a new keyword needs to be reserved (causing possible backward compatibility issues for old testsuites,
i.e. maintenance overhead for converting them to newer TTCN-3). But, the
PreDefFunctionIdentifier rule need not be changed in the BNF. For this alternative, change all 'ispresent' occurrences in the above description to 'present' and remove the change for the rule for PreDefFunctionIdentifier.
The name of the new modifier ispresent/present was chosen to match the semantics of the already existing constructs 'ispresent(field)' and '<template> ifpresent', where 'present' always means 'not omit'. Thus, the semantics of the new construct would be easily understandable for users of TTCN-3.

Steps To Reproduce |
Additional Information | Section 16.1. about functions also needs to be changed to align it with the BNF. In the section, only the keyword 'template' is allowed in the return clause, but the BNF states, that it also allows a 'RestrictedTemplate'.
Tags | No tags attached.
Relationships |

Attached Files

TemplateRestrictions.doc (31,744) 14-03-2008 12:23
http://oldforge.etsi.org/mantis/file_download.php?file_id=1383&type=bug
PreciseTemplates.ttcn (7,076) 14-03-2008 16:03
http://oldforge.etsi.org/mantis/file_download.php?file_id=1385&type=bug
CR_2975_Allow_specification_of_non-optional_templates_02.zip (848,125) 22-04-2008 12:24
http://oldforge.etsi.org/mantis/file_download.php?file_id=1428&type=bug
CR_2975_Allow_specification_of_non-optional_templates_03.zip (831,254) 22-04-2008 16:15
http://oldforge.etsi.org/mantis/file_download.php?file_id=1433&type=bug
CR_2975_Allow_specification_of_non-optional_templates_04.doc (1,650,176) 22-04-2008 19:53
http://oldforge.etsi.org/mantis/file_download.php?file_id=1436&type=bug
TemplateRestrictionsTest.ttcn (14,519) 22-04-2008 19:53
http://oldforge.etsi.org/mantis/file_download.php?file_id=1437&type=bug
CR_2975_Allow_specification_of_non-optional_templates_05.doc (1,660,928) 23-04-2008 19:18
http://oldforge.etsi.org/mantis/file_download.php?file_id=1448&type=bug

Issue History
Date Modified | Username | Field | Change
04-03-2008 10:01 | user324 | New Issue |
04-03-2008 10:01 | user324 | Status | new => assigned
04-03-2008 10:01 | user324 | Assigned To | => Ina Schieferdecker
04-03-2008 10:01 | user324 | Clause Reference(s) | => A.1.6.5, A.1.6.1.4, 11.2, 5.4.1.2, 16.1
04-03-2008 10:01 | user324 | Source (company - Author) | => Testing Technologies - Jacob Wieland
10-03-2008 14:55 | Thomas DeiÃŸ | Note Added: 0005186 |
10-03-2008 14:55 | Ina Schieferdecker | Target Version | => Edition 4.1.1 (not yet published)
14-03-2008 12:23 | Ina Schieferdecker | File Added: TemplateRestrictions.doc |
14-03-2008 16:03 | Thomas DeiÃŸ | File Added: PreciseTemplates.ttcn |
17-03-2008 09:47 | user324 | Note Added: 0005244 |
21-04-2008 08:54 | Ina Schieferdecker | Assigned To | Ina Schieferdecker => Gyorgy Rethy
21-04-2008 08:54 | Ina Schieferdecker | Target Version | Edition 4.1.1 (not yet published) => Edition 3.4.1 (not yet published)
22-04-2008 12:24 | Thomas DeiÃŸ | File Added: CR_2975_Allow_specification_of_non-optional_templates_02.zip |
22-04-2008 12:26 | Thomas DeiÃŸ | Note Added: 0005492 |
22-04-2008 15:58 | Gyorgy Rethy | File Added: CR_2975_Allow_specification_of_non-optional_templates_03.zip |
22-04-2008 16:15 | Gyorgy Rethy | File Deleted: CR_2975_Allow_specification_of_non-optional_templates_03.zip |
22-04-2008 16:15 | Gyorgy Rethy | File Added: CR_2975_Allow_specification_of_non-optional_templates_03.zip |
22-04-2008 16:17 | Gyorgy Rethy | Note Added: 0005497 |
22-04-2008 16:19 | Gyorgy Rethy | Note Added: 0005498 |
22-04-2008 16:19 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Thomas DeiÃŸ
22-04-2008 19:53 | Thomas DeiÃŸ | File Added: CR_2975_Allow_specification_of_non-optional_templates_04.doc |
22-04-2008 19:53 | Thomas DeiÃŸ | File Added: TemplateRestrictionsTest.ttcn |
22-04-2008 19:56 | Thomas DeiÃŸ | Note Added: 0005509 |
22-04-2008 19:56 | Thomas DeiÃŸ | Assigned To | Thomas DeiÃŸ => Ina Schieferdecker
23-04-2008 19:18 | Ina Schieferdecker | File Added: CR_2975_Allow_specification_of_non-optional_templates_05.doc |
23-04-2008 19:19 | Ina Schieferdecker | Resolution | open => fixed
23-04-2008 19:22 | Ina Schieferdecker | Status | assigned => resolved
24-04-2008 19:06 | Ina Schieferdecker | Status | resolved => closed
24-04-2008 19:06 | Ina Schieferdecker | Fixed in Version | => Edition 3.4.1 (not yet published)

Notes

(0005186)
Thomas DeiÃŸ
10-03-2008 14:55

related to introduction of restricted templates in edition 3.3. Potentially related to discussion of usage of valueof.

(0005244)
user324
17-03-2008 09:47

I have a problem with the PreciceTemplates example: template(omit) templates should also not be allowed to contain matching mechanisms (i.e. no ifpresent and no complement, as used in your examples), otherwise, you can pass such a template to a template(omit) parameter of a generic template(value) template and still get a runtime error if you send this 'value'.

(0005492)
Thomas DeiÃŸ
22-04-2008 12:26

STF349, Thomas: First draft for review. The major change is a new clause (15.8) on template restrictions, some other changes are in the BNF and in the explanation of template parameters.

(0005497)
Gyorgy Rethy
22-04-2008 16:17

Uploaded my comemnts in CR_2975_Allow_specification_of_non-optional_templates_03.zip. There are text enhancements only, no principal issues.

(0005498)
Gyorgy Rethy
22-04-2008 16:19

Thomas, I assigned it to you for review but Ina should also review it.

(0005509)
Thomas DeiÃŸ
22-04-2008 19:56

Removed irrelevant clauses, rules in BNF that need to be changed are highlighted, some minor corrections to changes proposed by Gyorgy. Supplementary TTCN-3 file uploaded, this can be seen as tests for this feature. After crosscheck by Ina, there should be another final crosscheck by Gyorgy.