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

ID | Project | Category | View Status | Date Submitted | Last Update
0007807 | Part 01: TTCN-3 Core Language | New Feature | public | 11-10-2018 08:58 | 06-01-2019 08:50

Reporter | Jacob Wieland - Spirent |
Assigned To | Gyorgy Rethy |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version |  | Fixed in Version | 4.11.1 (published 2019-05) |
Clause Reference(s) | 15.4
Source (company - Author) | Spirent - Jacob Wieland

Summary | 0007807: Generalizing the modifies operation

Description

At the moment, it is very restricted where you can use modifies, even though it is a powerful and useful construct.
It would be useful if the result of a modification could be directly used inside of a template expression (TemplateBody).
Also, at the moment, it is unclear what it means if a partially initialized variable (template or not) appears in the modification operand of the modifies construct. From the text it appears that it would possibly just overwrite the corresponding part in the parent template, but that would lead to assignments of uninitialized parts (circumventing the rule that you cannot un-initialize something already initialized).
Instead, uninitialized fields in the modification part should be treated as 'unchanged' for the purpose of the modification algorithm.
This has the property that it doesn't matter whether I first assign the modification to a variable and then use the variable or write the same syntax in the modification directly:
var MyRecord x := { f1 := 1, f2 := - } // f2 remains uninitialized
template MyRecord t modifies t2 := x; // f2 remains unchanged
would be the same as
template MyRecord t modifies t2 := { f1 := 1, f2 := - }
This has the advantage that modifications can be stored in variables, passed around as parameters and be reused and even modified themselves.
Syntactically, because the current 'inline' version of modifies has the confusing assignment symbol, we should instead introduce a new mixfix operator:
modifies <ParentTemplate> { with <ModificationTemplate> }+
The grammar should be amended in the following way:
Rename the rule of TemplateBody to BaseTemplateBody
Introduce new rules:
TemplateBody ::= BaseTemplateBody | DerivedTemplateBody
DerivedTemplateBody ::= ModifiesKeyword BaseTemplateBody {WithKeyword BaseTemplateBody}+

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files | CR7807.docx (181,870) 12-10-2018 10:01 http://oldforge.etsi.org/mantis/file_download.php?file_id=3810&type=bug

Issue History
Date Modified | Username | Field | Change
11-10-2018 08:58 | Jacob Wieland - Spirent | New Issue |
11-10-2018 11:58 | Jacob Wieland - Spirent | Assigned To | => Jacob Wieland - Spirent
11-10-2018 11:58 | Jacob Wieland - Spirent | Status | new => assigned
12-10-2018 10:01 | Jacob Wieland - Spirent | File Added: CR7807.docx |
12-10-2018 10:03 | Jacob Wieland - Spirent | Note Added: 0015269 |
12-10-2018 10:04 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Tomas Urban
12-10-2018 10:04 | Jacob Wieland - Spirent | Status | assigned => confirmed
12-10-2018 10:57 | Tomas Urban | Note Added: 0015270 |
12-10-2018 10:57 | Tomas Urban | Status | confirmed => resolved
12-10-2018 10:57 | Tomas Urban | Resolution | open => fixed
12-10-2018 10:57 | Tomas Urban | Assigned To | Tomas Urban => Gyorgy Rethy
06-01-2019 08:22 | Gyorgy Rethy | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
06-01-2019 08:50 | Gyorgy Rethy | Note Added: 0015325 |
06-01-2019 08:50 | Gyorgy Rethy | Status | resolved => closed
06-01-2019 08:50 | Gyorgy Rethy | Fixed in Version | => 4.11.1 (published 2019-05)

Notes

(0015269)
Jacob Wieland - Spirent
12-10-2018 10:03

As the 'with' clashes with the with-part (at least if repeated) and the := syntax and the with syntax are so similar in placement, I just generalized the modified template to a TemplateBody and distinguish between TemplateBody, DerivedTemplateBody (the inline modifies construct) and BaseTemplateBody (all other template body constructions) where the left and right hand side of DerivedTemplateBody can only be BaseTemplateBody (to avoid weird stacking of modifies without giving parantheses).
Please check.

(0015270)
Tomas Urban
12-10-2018 10:57

Reviewed. No issues found. Can be added to the next version of the core language specification.

(0015325)
Gyorgy Rethy
06-01-2019 08:50

Added to draft v4.10.2