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

ID | Project | Category | View Status | Date Submitted | Last Update
0005976 | Part 01: TTCN-3 Core Language | New Feature | public | 29-11-2011 13:09 | 13-01-2015 18:31

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 | v4.5.1 (published 2013-04) | Fixed in Version | v4.7.1 (published 2015-06) |
Clause Reference(s) | 6.2.5, 19.3
Source (company - Author) | Testing Technologies - Jacob Wieland

Summary | 0005976: The select statement should get a shorthand notation for switching over union variants

Description

At the moment there is no efficient way in TTCN-3 to switch over the different variants of a union type in a nice syntactic way. If a union has very many alternatives (e.g. when it is comprising all PDU-types of a protocol), this could lead to (unnecessary) performance issues at runtime. Also it would increase readability and thereby decrease maintenance costs.
Therefore, I would like to propose an additional semantics for the select statement:
assume the following definition:
type union U {
T1 v1, ... Tn vn
}
and a context where expression 'u' is of type U.
Then, the user should be able to write
select (u) {
case (v1) { // do something with u.v1 ...
}
...
case (vn) { // do something with u.vn
}
}
This should then be a shorthand notation for:
select (u) {
case ({ v1 := ? }) { // do something with u.v1
}
...
case ({ vn := ? }) { // do something with u.vn
}
}
Like for enumerated types, the union-variant-identifiers shall take precedence over other identifiers of the same name existent in this context (where global identifiers could still be used by module-prefixing).
Alternatively, a new construct selectchosen() with the same syntax as the select construct but only applicable to union values where only union variant identifiers can be used in the cases could be introduced to avoid the nameclash issues.
To avoid the multiple repetition of the expression u (which could also be a very length expression), the selectchosen() construct could even imply a constant declaration const Tn vn := u.vn; for each case (vn), thereby considerably shortening the TTCN-3 code.
This is reminiscent of the WITH-statement of MODULA.

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |

Attached Files

CR5976.doc (677,376) 29-11-2011 19:01
http://oldforge.etsi.org/mantis/file_download.php?file_id=2613&type=bug
CR5976_resolution_v2.doc (729,088) 30-11-2011 09:28
http://oldforge.etsi.org/mantis/file_download.php?file_id=2615&type=bug
CR5976_resolution_v2-comments.doc (674,816) 30-11-2011 11:28
http://oldforge.etsi.org/mantis/file_download.php?file_id=2618&type=bug
CR5976_resolution_v3.doc (668,672) 30-11-2011 15:56
http://oldforge.etsi.org/mantis/file_download.php?file_id=2621&type=bug
CR5976_resolution_v4.doc (757,248) 02-12-2011 14:18
http://oldforge.etsi.org/mantis/file_download.php?file_id=2658&type=bug

Issue History
Date Modified | Username | Field | Change
29-11-2011 13:09 | Jacob Wieland - Spirent | New Issue |
29-11-2011 13:09 | Jacob Wieland - Spirent | Clause Reference(s) | => 6.2.5, 19.3
29-11-2011 13:09 | Jacob Wieland - Spirent | Source (company - Author) | => Testing Technologies - Jacob Wieland
29-11-2011 19:01 | Jacob Wieland - Spirent | File Added: CR5976.doc |
29-11-2011 19:02 | Jacob Wieland - Spirent | Note Added: 0010408 |
29-11-2011 19:03 | Jacob Wieland - Spirent | Note Added: 0010409 |
29-11-2011 19:03 | Jacob Wieland - Spirent | Status | new => assigned
29-11-2011 19:03 | Jacob Wieland - Spirent | Assigned To | => Gyorgy Rethy
30-11-2011 08:02 | Gyorgy Rethy | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
30-11-2011 08:03 | Gyorgy Rethy | Target Version | => Edition 4.4.1
30-11-2011 09:28 | Gyorgy Rethy | File Added: CR5976_resolution_v2.doc |
30-11-2011 09:29 | Gyorgy Rethy | Note Added: 0010415 |
30-11-2011 09:29 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Jacob Wieland - Spirent
30-11-2011 11:28 | Jacob Wieland - Spirent | File Added: CR5976_resolution_v2-comments.doc |
30-11-2011 11:29 | Jacob Wieland - Spirent | Note Added: 0010439 |
30-11-2011 11:31 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gyorgy Rethy
30-11-2011 15:41 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Jacob Wieland - Spirent
30-11-2011 15:56 | Jacob Wieland - Spirent | File Added: CR5976_resolution_v3.doc |
30-11-2011 15:58 | Jacob Wieland - Spirent | Note Added: 0010448 |
30-11-2011 15:58 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gyorgy Rethy
02-12-2011 14:18 | Gyorgy Rethy | File Added: CR5976_resolution_v4.doc |
02-12-2011 14:20 | Gyorgy Rethy | Note Added: 0010527 |
02-12-2011 14:21 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
02-12-2011 14:21 | Gyorgy Rethy | Status | assigned => resolved
02-12-2011 14:21 | Gyorgy Rethy | Resolution | open => fixed
04-06-2012 06:17 | Ina Schieferdecker | Note Added: 0010628 |
04-06-2012 06:17 | Ina Schieferdecker | Target Version | Edition 4.4.1 => v4.7.1 (published 2015-06)
10-07-2012 19:28 | Ina Schieferdecker | Note Added: 0010779 |
10-07-2012 19:28 | Ina Schieferdecker | Status | resolved => closed
10-07-2012 19:28 | Ina Schieferdecker | Fixed in Version | => Edition 4.5.1
12-12-2014 09:48 | Jacob Wieland - Spirent | Assigned To | Ina Schieferdecker => Gyorgy Rethy
12-12-2014 09:48 | Jacob Wieland - Spirent | Note Added: 0012543 |
12-12-2014 09:48 | Jacob Wieland - Spirent | Status | closed => feedback
12-12-2014 09:48 | Jacob Wieland - Spirent | Resolution | fixed => reopened
13-01-2015 12:55 | Gyorgy Rethy | Resolution | reopened => fixed
13-01-2015 12:55 | Gyorgy Rethy | Fixed in Version | v4.5.1 (published 2013-04) => v4.7.1 (published 2015-06)
13-01-2015 18:31 | Gyorgy Rethy | Note Added: 0012672 |
13-01-2015 18:31 | Gyorgy Rethy | Status | feedback => closed

Notes

(0010408)
Jacob Wieland - Spirent
29-11-2011 19:02

uploaded proposal text

(0010409)
Jacob Wieland - Spirent
29-11-2011 19:03

please review

(0010415)
Gyorgy Rethy
30-11-2011 09:29

See changes and explanations in file CR5976_resolution_v2.doc. Pls. review.

(0010439)
Jacob Wieland - Spirent
30-11-2011 11:29

added some comments to your comments. maybe we should have a stf-wide discussion about this part of the feature

(0010448)
Jacob Wieland - Spirent
30-11-2011 15:58

okay, changed example to be a bit more verbose, deleted example 2 (which was just to illustrate the name-clashing problem anyway).

(0010527)
Gyorgy Rethy
02-12-2011 14:20

OK with me. Only editorial changes (e.g. must->shall, a partially initialized union always has exactly one alternative selected) in the file CR5976_resolution_v4.doc.

(0010628)
Ina Schieferdecker
04-06-2012 06:17

Has not yet been implemented in part 1!

(0010779)
Ina Schieferdecker
10-07-2012 19:28

Implemented as proposed

(0012543)
Jacob Wieland - Spirent
12-12-2014 09:48

somehow, it was forgotten to REALLY implement this in 4.5.1 (the section is missing) and therefore, it is also missing in 4.6.1 and 4.6.2! Please correct this as soon as possible.

(0012672)
Gyorgy Rethy
13-01-2015 18:31

Added to draft V4.6.4