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

ID | Project | Category | View Status | Date Submitted | Last Update
0007294 | Part 01: TTCN-3 Core Language | New Feature | public | 08-01-2016 11:12 | 16-12-2016 22:35

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.9.1 (published 2017-05) | Fixed in Version | v4.9.1 (published 2017-05) |
Clause Reference(s) | 5.4.1.1, 5.4.1.2
Source (company - Author) | Jacob Wieland

Summary | 0007294: default values/templates of formal parameters should live in the runs-on scope

Description

If a function or altstep has a runs-on clause, it is assured that it can only be called from another context which has a runs-on-compatible runs-on context. That means that all members of the runs-on type of the called function/altstep also exist in the calling behavior or in the component that is started with this function/altstep.
Therefore, the restriction e) in 5.4.1.1. can be relaxed insofar that default values of formal parameters may reference the members of the runs-on component type without any averse effects. This change would be backward compatible.
The same, of course, is also true for restriction d) in 5.4.1.2.

Steps To Reproduce | type component A { var integer i := 0; } type component B extends A { var integer j; } function f(integer x := i + 1) runs on A { if (x > i) { ... } } function g() runs on B { f(-); B.create.start(f(-)); }
Additional Information | This feature was inspired by a use-case where an additional parameter was introduced later on but for backward compatibility reasons was to be filled per default with the value of a component variable which was previously used in its place.
Tags | No tags attached.

Relationships

related to | 0007454 | closed | Jens Grabowski | Part 04: TTCN-3 Operational Semantics | Operational semantics for default parameters
related to | 0007573 | closed | Gyorgy Rethy | Ext Pack: Advanced Parametrization (ES 202 784) | Default types shall not refer to value parameters

Attached Files | CR7294-1.docx (29,215) 19-07-2016 08:26 http://oldforge.etsi.org/mantis/file_download.php?file_id=3414&type=bug CR7294-2.docx (32,715) 20-07-2016 10:46 http://oldforge.etsi.org/mantis/file_download.php?file_id=3422&type=bug CR7294-3.docx (27,828) 20-07-2016 12:36 http://oldforge.etsi.org/mantis/file_download.php?file_id=3425&type=bug

Issue History
Date Modified | Username | Field | Change
08-01-2016 11:12 | Jacob Wieland - Spirent | New Issue |
18-07-2016 10:55 | Jens Grabowski | Assigned To | => Tomas Urban
18-07-2016 10:55 | Jens Grabowski | Status | new => assigned
19-07-2016 08:26 | Tomas Urban | File Added: CR7294-1.docx |
19-07-2016 08:44 | Tomas Urban | Relationship added | related to 0007454
19-07-2016 08:46 | Tomas Urban | Note Added: 0013984 |
19-07-2016 08:46 | Tomas Urban | Assigned To | Tomas Urban => Jacob Wieland - Spirent
19-07-2016 12:30 | Jacob Wieland - Spirent | Note Added: 0013988 |
19-07-2016 12:30 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Jens Grabowski
19-07-2016 15:00 | Jens Grabowski | Note Added: 0013990 |
19-07-2016 15:01 | Jens Grabowski | Assigned To | Jens Grabowski => Tomas Urban
20-07-2016 10:46 | Tomas Urban | File Added: CR7294-2.docx |
20-07-2016 10:48 | Tomas Urban | Note Added: 0014000 |
20-07-2016 10:48 | Tomas Urban | Assigned To | Tomas Urban => Jacob Wieland - Spirent
20-07-2016 10:48 | Tomas Urban | Status | assigned => confirmed
20-07-2016 12:36 | Jacob Wieland - Spirent | File Added: CR7294-3.docx |
20-07-2016 12:37 | Jacob Wieland - Spirent | Note Added: 0014006 |
20-07-2016 12:38 | Jacob Wieland - Spirent | Status | confirmed => assigned
20-07-2016 12:38 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Tomas Urban
20-07-2016 12:38 | Jacob Wieland - Spirent | Status | assigned => confirmed
20-07-2016 16:18 | Tomas Urban | Note Added: 0014013 |
20-07-2016 16:19 | Tomas Urban | Assigned To | Tomas Urban => Gyorgy Rethy
20-07-2016 16:19 | Tomas Urban | Status | confirmed => resolved
17-08-2016 11:13 | Jacob Wieland - Spirent | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
17-08-2016 11:59 | Jacob Wieland - Spirent | Status | resolved => feedback
17-08-2016 11:59 | Jacob Wieland - Spirent | Resolution | open => reopened
17-08-2016 11:59 | Jacob Wieland - Spirent | Target Version | => v4.9.1 (published 2017-05)
17-08-2016 12:00 | Jacob Wieland - Spirent | Status | feedback => resolved
17-08-2016 12:00 | Jacob Wieland - Spirent | Fixed in Version | => v4.9.1 (published 2017-05)
17-08-2016 12:00 | Jacob Wieland - Spirent | Resolution | reopened => fixed
13-12-2016 07:48 | Gyorgy Rethy | Note Added: 0014400 |
13-12-2016 08:15 | Gyorgy Rethy | Note Edited: 0014400 | bug_revision_view_page.php?bugnote_id=14400#r344
13-12-2016 08:16 | Gyorgy Rethy | Status | resolved => feedback
13-12-2016 08:16 | Gyorgy Rethy | Resolution | fixed => reopened
14-12-2016 13:24 | Jacob Wieland - Spirent | Note Added: 0014436 |
14-12-2016 13:24 | Jacob Wieland - Spirent | Status | feedback => assigned
16-12-2016 19:43 | Gyorgy Rethy | Note Added: 0014450 |
16-12-2016 22:32 | Gyorgy Rethy | Note Edited: 0014450 | bug_revision_view_page.php?bugnote_id=14450#r352
16-12-2016 22:32 | Gyorgy Rethy | Relationship added | related to 0007573
16-12-2016 22:35 | Gyorgy Rethy | Note Added: 0014458 |
16-12-2016 22:35 | Gyorgy Rethy | Status | assigned => closed
16-12-2016 22:35 | Gyorgy Rethy | Resolution | reopened => fixed

Notes

(0013984)
Tomas Urban
19-07-2016 08:46

Resolved as proposed. Please check.

(0013988)
Jacob Wieland - Spirent
19-07-2016 12:30

In my opinion, we could also include functions with a compatible runs on(system,mtc) clause than the function with the default parameter.
The reasoning behind this is the following: a default parameter is only evaluated in case that the calling context did not provide an actual parameter. Therefore, the evaluation of that default parameter can be deferred until the beginning of the called behaviour, these assignments are basically part of the behaviour block which is already running on the runs-on component.
Therefore, it doesn't matter what the calling context was and it also doesn't matter whether the default parameter is blocking or has side-effects. It is clear when they are evaluated.
Basically, what I'm saying is that:
function f(T x := E) runs on C {
S1;
...
;Sn
}
is semantically equivalent to
function f(T x) runs on C {
if (not isbound(x)) { x := E }
S1;
...
Sn
}
and isbound(x) for an in-parameter can only be true if a - is given as actual parameter.
The exception from this rule is altsteps that are used as default alts, where, of course, all the restrictions applied for the local variable initializations also must apply to the default values (no side-effects, no blocking).

(0013990)
Jens Grabowski
19-07-2016 15:00

I agree with Jacob. Tomas, can you check the comment from Jacob. If you also agree, please adapt the proposal. Apart from possibly required changes, the proposal is ok.

(0014000)
Tomas Urban
20-07-2016 10:48

Updated as proposed: the sentence concerning the functions was removed and a new rule was added to the chapter on altsteps (operations with side effects) Please review.

(0014006)
Jacob Wieland - Spirent
20-07-2016 12:37

reformulated the restrictions added sentences when these default expressions are evaluated please review

(0014013)
Tomas Urban
20-07-2016 16:18

Fine by me. The third proposal is acceptable as the solution of the CR.

(0014400)
Gyorgy Rethy
13-12-2016 07:48 (edited on: 13-12-2016 08:15)

Added to draft V4.8.2 as in the CR.
However the meaning of "any following" is unclear to me in "shall not refer to other parameters of the same or any following parameter list." (in restriction d of clauses 5.4.1.1 and 5.4.1.2). A testcase/function/altstep have a list of formal parameters; this is "the same" parameter list as in which the default value is defined; but what is "the following" parameter list?

(0014436)
Jacob Wieland - Spirent
14-12-2016 13:24

The restriction is intended to avoid situations like this:
type component C {
var template integer b := (0 .. 100);
}
type record Pair(template integer a, template integer b) {
integer first(a),
integer second(b)
}
function f<T := Pair(a,b)>(template integer a) runs on C {
}
Here, the default type value would reference both a variable from the runs-on component and a formal parameter from the following value parameter list.
While this is, of course, a pathological case, it still needs to be restricted to not occur, in my opinion.

(0014450)
Gyorgy Rethy
16-12-2016 19:43 (edited on: 16-12-2016 22:32)

Technically correct; but this shall be added to the language extension on advanced parameterization. CR 7573 has been created and done for this purpose.

(0014458)
Gyorgy Rethy
16-12-2016 22:35

Added to draft V4.8.2 except "or any following", which has been added to the advanced parameterization package.