ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details
0006691Part 01: TTCN-3 Core LanguageClarificationpublic21-02-2014 07:4106-01-2015 19:15
Tomas Urban 
Gyorgy Rethy 
normalminorN/A
closedfixed 
v4.5.1 (published 2013-04) 
v4.7.1 (published 2015-06)v4.7.1 (published 2015-06) 
21.1
Elvior
0006691: Port visibility in compile time in connection operations
With the introduction of mtc and system clauses in 4.6.1, it is possible to achieve that all component references in connection operations are strongly typed. However, the current specification doesn't actually say that this strong typing influences port references used in communication operations in any way and it is not obvious whether such port references shall be resolved according to the strong typing rules in compilation time or in runtime using the real component instance. The same problem was present in earlier specifications too, but then it only concerned component variables and reference to self.

Let's demonstrate it on the example:

type port P message { inout integer; }
type component C1 { port P p1; }
type component C2 { port P p1, p2; }

testcase TC runs on C1 system C1
{
  var C1 v_ptc := C2.create; // valid assignment: C2 is compatible in C1
  // In the following statement, v_ptc:p2 is not visible according to strong
  // typing rules, but the real instance contains the port p2. Static check
  // made in compilation time should print an error, but runtime check would
  // succeed
  connect(self:p1, v_ptc:p2);
}

In strongly typed languages, static checks are typically made in these cases leading to compilation errors. In order to prevent it, it is necessary to use explicit casting. TTCN-3 doesn't have any casting concept, but it is possible to use alternative approaches, such as assignment to a temporary variable or typing on the function level using runs on, mtc and system clauses. For this reason, I suggest to introduce strong typing rules for situations when the component type is known by adding the following rule to the section 21.1.1 and 21.1.2:

If the type of the component referenced in a connection operation is known (either when the component reference is a variable or value returned from a function or the type is defined the runs on, mtc or system clause of the calling function), the referenced port declaration shall be present in this component type.

It would be also beneficial to add an example to demonstrate this rule.

For test suites with untyped mtc and system, everything would remain the same, because only runtime resolution is possible in these cases. If the proposed strong typing rule is not acceptable, the core language specification should still say that the port reference are related to the actual instance. Otherwise there will be different interpretations by tool vendors leading to real test suites portability issues.

No tags attached.
docx CR6691_update_proposal.docx (25,754) 10-04-2014 13:49
http://oldforge.etsi.org/mantis/file_download.php?file_id=3001&type=bug
docx CR6691_v2.docx (27,148) 07-10-2014 15:18
http://oldforge.etsi.org/mantis/file_download.php?file_id=3100&type=bug
docx CR6691_v3.docx (21,601) 07-10-2014 15:29
http://oldforge.etsi.org/mantis/file_download.php?file_id=3101&type=bug
Issue History
21-02-2014 07:41Tomas UrbanNew Issue
07-04-2014 15:43Gyorgy RethyNote Added: 0011944
07-04-2014 15:51Gyorgy RethyAssigned To => Axel Rennoch
07-04-2014 15:51Gyorgy RethyStatusnew => assigned
08-04-2014 17:01Gyorgy RethyTarget Version => v4.7.1 (published 2015-06)
10-04-2014 13:49Axel RennochFile Added: CR6691_update_proposal.docx
10-04-2014 13:49Axel RennochAssigned ToAxel Rennoch => Gyorgy Rethy
10-04-2014 13:50Axel RennochNote Added: 0012006
10-04-2014 13:50Axel RennochStatusassigned => confirmed
06-10-2014 15:29Gyorgy RethyAssigned ToGyorgy Rethy => Jens Grabowski
07-10-2014 15:18Tomas UrbanFile Added: CR6691_v2.docx
07-10-2014 15:29Jens GrabowskiFile Added: CR6691_v3.docx
07-10-2014 15:29Jens GrabowskiAssigned ToJens Grabowski => Gyorgy Rethy
07-10-2014 15:29Jens GrabowskiStatusconfirmed => assigned
07-10-2014 15:29Jens GrabowskiStatusassigned => resolved
07-10-2014 15:29Jens GrabowskiResolutionopen => fixed
06-01-2015 19:15Gyorgy RethyNote Added: 0012659
06-01-2015 19:15Gyorgy RethyStatusresolved => closed
06-01-2015 19:15Gyorgy RethyFixed in Version => v4.7.1 (published 2015-06)

Notes
(0011944)
Gyorgy Rethy   
07-04-2014 15:43   
stf478, 2014-04-07: type-restriction based limitation applies, i.e. the above connect example shall produce an error. Standard has to be checked, if it is unambiguous from the text and amend if needed.
(0012006)
Axel Rennoch   
10-04-2014 13:50   
Problem: assignments to component instance may cause non-visible ports within components

Approach: existing port identifiers that are not visible could not be detected at compile time and should not be used in connection statements
(0012659)
Gyorgy Rethy   
06-01-2015 19:15   
Added to draft V4.6.3