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

ID | Project | Category | View Status | Date Submitted | Last Update
0006562 | Part 01: TTCN-3 Core Language | Clarification | public | 24-05-2013 15:35 | 12-07-2013 10:26

Reporter | Tomas Urban |
Assigned To | Ina Schieferdecker |
Priority | normal | Severity | minor | Reproducibility | always
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.4.1 (published 2012-04) |
Target Version | v4.6.1 (published 2014-06) | Fixed in Version | v4.6.1 (published 2014-06) |
Clause Reference(s) | 15
Source (company - Author) | Elvior

Summary | 0006562: Use of template references in expression

Description

We have had a long discussion with the STF writing TTCN-3 complience test regarding refencing templates in expressions and it seems that we cannot find a common stance. Our position is that regardless of what the template contains, it cannot be used in expressions directly. The STF claims that if the template contains a value (and no matching symbols), it can be refenced.
There are arguments supporting both interpretations:
1. The BNF doesn't seem to contain any static semantics about references inside expressions (supporting STF's position)
2. On the other hand, the BNF makes a difference between ReferencedValue and TemplateRefWithParList. This means that instances of parameterized templates are not allowed in expressions which wouldn't make sense if common templates were allowed.
3. If direct template referencing were possible, the valueof operator would be completely useless.
Proposal:
An explicit rule shall be added to the core language specification (either chapter 7 or 15) saying that template refences are either allowed (if they contain no matching symbols) or forbidden in expressions. We support the latter option, because it allows the user to discover potentially harmful use of template reference already in compilation time. However, we think it is worth of considering, whether this restriction shall apply to templates with a value restriction, because they cannot contain matching symbols and therefore it is safe to use them inside expressions.

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

Relationships

related to | 0006580 | closed | Ina Schieferdecker | It must be clarified in the standard whether the first parameter in match() can be a template

Attached Files

CR6562_resolution_v1.doc (82,432) 09-07-2013 11:56
http://oldforge.etsi.org/mantis/file_download.php?file_id=2804&type=bug
CR6562_resolution_v2.doc (83,456) 10-07-2013 08:50
http://oldforge.etsi.org/mantis/file_download.php?file_id=2806&type=bug
CR6562_resolution_v3.doc (83,456) 10-07-2013 14:19
http://oldforge.etsi.org/mantis/file_download.php?file_id=2808&type=bug
CR6562_resolution_v4.doc (84,992) 11-07-2013 16:00
http://oldforge.etsi.org/mantis/file_download.php?file_id=2835&type=bug
CR6562_resolution_v5.doc (74,240) 11-07-2013 16:12
http://oldforge.etsi.org/mantis/file_download.php?file_id=2840&type=bug

Issue History
Date Modified | Username | Field | Change
24-05-2013 15:35 | Tomas Urban | New Issue |
24-05-2013 15:35 | Tomas Urban | Clause Reference(s) | => 15
24-05-2013 15:35 | Tomas Urban | Source (company - Author) | => Elvior
08-07-2013 12:00 | Jacob Wieland - Spirent | Note Added: 0011448 |
08-07-2013 14:31 | Jens Grabowski | Status | new => assigned
08-07-2013 14:31 | Jens Grabowski | Assigned To | => Ina Schieferdecker
08-07-2013 14:33 | Jens Grabowski | Assigned To | Ina Schieferdecker => Gyorgy Rethy
08-07-2013 16:38 | Gyorgy Rethy | Target Version | => v4.6.1 (published 2014-06)
09-07-2013 11:55 | Gyorgy Rethy | Note Added: 0011460 |
09-07-2013 11:56 | Gyorgy Rethy | File Added: CR6562_resolution_v1.doc |
09-07-2013 13:46 | Jacob Wieland - Spirent | Note Added: 0011468 |
09-07-2013 14:01 | Jacob Wieland - Spirent | Note Added: 0011473 |
10-07-2013 08:50 | Gyorgy Rethy | Note Added: 0011491 |
10-07-2013 08:50 | Gyorgy Rethy | File Added: CR6562_resolution_v2.doc |
10-07-2013 11:59 | Gyorgy Rethy | Note Edited: 0011491 |
10-07-2013 12:02 | Gyorgy Rethy | Note Edited: 0011460 |
10-07-2013 13:31 | Gyorgy Rethy | Note Added: 0011501 |
10-07-2013 13:32 | Gyorgy Rethy | File Added: CR6562_resolution_v3.doc |
10-07-2013 13:32 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
10-07-2013 13:32 | Gyorgy Rethy | Status | assigned => resolved
10-07-2013 13:32 | Gyorgy Rethy | Resolution | open => fixed
10-07-2013 13:42 | Gyorgy Rethy | Note Edited: 0011460 |
10-07-2013 13:51 | Gyorgy Rethy | Note Added: 0011502 |
10-07-2013 13:51 | Gyorgy Rethy | Note Edited: 0011502 |
10-07-2013 14:19 | Gyorgy Rethy | File Deleted: CR6562_resolution_v3.doc |
10-07-2013 14:19 | Gyorgy Rethy | File Added: CR6562_resolution_v3.doc |
11-07-2013 08:46 | Gyorgy Rethy | Relationship added | related to 0006580
11-07-2013 11:09 | Ina Schieferdecker | Note Added: 0011534 |
11-07-2013 11:09 | Ina Schieferdecker | Assigned To | Ina Schieferdecker => Gyorgy Rethy
11-07-2013 11:09 | Ina Schieferdecker | Status | resolved => confirmed
11-07-2013 14:22 | Gyorgy Rethy | Note Added: 0011547 |
11-07-2013 14:24 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
11-07-2013 14:24 | Gyorgy Rethy | Status | confirmed => resolved
11-07-2013 15:59 | Ina Schieferdecker | Note Added: 0011555 |
11-07-2013 16:00 | Ina Schieferdecker | File Added: CR6562_resolution_v4.doc |
11-07-2013 16:00 | Ina Schieferdecker | Status | resolved => assigned
11-07-2013 16:00 | Ina Schieferdecker | Assigned To | Ina Schieferdecker => Gyorgy Rethy
11-07-2013 16:12 | Gyorgy Rethy | File Added: CR6562_resolution_v5.doc |
11-07-2013 16:13 | Gyorgy Rethy | Note Added: 0011560 |
11-07-2013 16:14 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
11-07-2013 16:14 | Gyorgy Rethy | Status | assigned => confirmed
12-07-2013 10:25 | Ina Schieferdecker | Status | confirmed => resolved
12-07-2013 10:25 | Ina Schieferdecker | Fixed in Version | => v4.6.1 (published 2014-06)
12-07-2013 10:26 | Ina Schieferdecker | Status | resolved => closed

Notes

(0011448)
Jacob Wieland - Spirent
08-07-2013 12:00

This would introduce huge backward-incompatibility issues. The load for reducing user-errors should be shouldered by the tools (i.e. by warnings) and not by unnecessary restrictions of the standard.
The basic problem stems from the usage of templates both for building messages for sending (definitely a value) and for matching (probably no value). Later introduced template restrictions have alleviated this problem somewhat but the problem remains for the unrestricted templates.
Maybe the unrestricted template construct should be made deprecated so that future test suites will be discouraged from using this feature.

(0011460)
Gyorgy Rethy
09-07-2013 11:55 (edited on: 10-07-2013 13:42)

In TTCN-3 a data is a value or template by _definition_ and not by content. Let separate the problem into two parts: 1) can template be used in expressions? 2) Is it defined clearly enough what is a template and what is a value?
1) Clause Semantic Description says:
"The operands of the operators used in an expression shall be values..."
I think this statement is sufficient.
The BNF specifies the syntax only, therefore it is more "allowing" than the language as a whole, no conclusions can be made based on the BNF only. For example, OpCall also contains TestcaseInstance, while it cannot be present in any Expression, just in Expressions in the control part.
Expressions in TTCN-3 today mean both "pure" references and "real" expressions involving operations. While simple references can be templates, if the LHS is a template, "real" expressions can contain values only, i.e. no templates with value content is allowed. In principle, these two cases could be separated in the BNF but value/template returning functions would make this separation complicated.
Examples:
const integer c_int1 := 5;
const integer c_int2 := 42;
template integer t_int := 0;
...
var template integer vt_int := t_int; // allowed, both RHS and LHS are templates, Expression is: "t_int"
var integer v_int := c_int2 - c_int1; allowed,Expression is a operands are values
v_int := vt_int; //not allowed, if RHS is template, LHS shall be a template too
// Expression is: "t_int"
2) Once this question is coming up time-to-time, it seems that the standard should define even more precisely what is a value and what is a template. See my proposal in the attached file CR6562_resolution_v1.doc.

(0011468)
Jacob Wieland - Spirent
09-07-2013 13:46

"A TTCN 3 value is a data object containing a specific value of its type" seems to be a circular definition to me (as we are in the definition of "value"). I guess an actual definition would have to employ some set/type-theory to be non-circular.

(0011473)
Jacob Wieland - Spirent
09-07-2013 14:01

Basically, I would define a value as a distinct element of a type while a template describes the (possibly single-element) subset of values of a type that it matches.
So, while the set of single-element subsets of a type is isomorphic to the set of values of a type, it is not the same thing. The valueof operation is a partial operation on the set of templates which maps the subset of one-element-sets to its value counterparts (i.e. the single value they match).

(0011491)
Gyorgy Rethy
10-07-2013 08:50 (edited on: 10-07-2013 11:59)

Good point, Jacob, see the updated definitions in CR6562_resolution_v2.doc.

(0011501)
Gyorgy Rethy
10-07-2013 13:31

STF decision 2013-07-10: - No need to change the BNF and the sentence saying that operands shall be values is sufficient (i.e. when no operation is involved, expression (the RHS) can be both values or templates provided the restrictions are respected, but operands shall be values only). - For definition of templates and values see CR6562_resolution_v3.doc

(0011502)
Gyorgy Rethy
10-07-2013 13:51

I propose, in addition, to amend the first sentence of clause 7.
The sentence now: "TTCN 3 allows the specification of expressions using the operators defined in clause 7.1."
Proposed text: "TTCN 3 allows the specification of expressions. TTCN-3 Expressions may be simple template or value references or literals (i.e. no operation is involved), or may be composed of the operations defined in clause 7.1."

(0011534)
Ina Schieferdecker
11-07-2013 11:09

Sentence in clause 7 better reworded into "TTCN 3 allows the specification of expressions. TTCN-3 expressions may be template references, value references or literals (i.e. no operation is involved), and may be composed of the operations defined in clause 7.1."

(0011547)
Gyorgy Rethy
11-07-2013 14:22

OK with me.

(0011555)
Ina Schieferdecker
11-07-2013 15:59

Some more rewording - please see v4

(0011560)
Gyorgy Rethy
11-07-2013 16:13

Amended the last sentence of the template definition to make it symmetric to the value definition. See in CR6562_resolution_v5.doc