ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details
0000416Part 01: TTCN-3 Core LanguageClarificationpublic24-11-2006 14:3412-03-2008 10:24
Stephan Schulz 
Ina Schieferdecker 
highblockN/A
closedfixed 
v3.1.1 (published 2005-06) 
v3.3.2 (published 2008-04)v3.3.2 (published 2008-04) 
-
dr. György Réthy, Ericsson
0000416: Passing omit to value formal parameters
The TTCN-3 standard today does not defines the term "value". In common sense value means "In computer science, a value may be a number, literal string, array and anything that can be treated as if it were a number. ... The exact definition varies across programming languages." (from the English Wikipedia, Value (computer science) item). "Nothing" is not a value, i.e. omit should not be considered as value in TTCN-3. This meaning is strengthened by the TTCN-3 standard, where omit is mentioned as a matching mechanism (though it can also be PART of a value, i.e. assigned to optional fields. Titan follows this approach and allows to pass real specific values to value parameters only but not omit. This provides a big advantage: it is sufficient to check the "value" of a value formal parameter when it is passed, no need for subsequent checks when it is used e.g. in expressions.
However, in many cases it would be useful to allow formal parameters accepting specific values and omit, e.g. when this parameter is passed to optional template fields in sending operations.
It is proposed to make a distinction between value formal parameters allowing omit and not allowing omit in the TTCN-3 language.

Formal parameters
To denote that the special value omit is allowed for a value formal parameter, the optional keyword shall be used in the formal parameter list of test cases, functions, altsteps or templates. In the testcase/function/altstep the optional parameter can be compared with omit to determine if a concrete value has been provided or omit was given when calling it.
Example code:
function f_MyFunc1 (optional integer par)
{
   if (par==omit) {
      // omit was given for par
   } else {
      // value was provided for par
   }
}
The parameters with default value (see CR 406) and optional parameters are independent features. The user can combine the two features,
Example code:
function f_MyFunc2(optional integer par1, optional integer par2 := omit, integer par3 := 5 )
{ ... }

Actual parameters
Optional value parameters may be called with a concrete value or with omit as actual parameter.
Example code:
f_MyFunc1(11);
f_MyFunc1(omit);
f_MyFunc2(omit); // par1 & par2 will have the actual value omit,
                 // par3 will have the actual value 5

No tags attached.
zip CR_416_v2.zip (890,821) 06-12-2007 11:51
http://oldforge.etsi.org/mantis/file_download.php?file_id=1234&type=bug
zip CR_416_v3.zip (885,232) 06-12-2007 17:01
http://oldforge.etsi.org/mantis/file_download.php?file_id=1242&type=bug
zip CR_416_v4.zip (869,220) 06-12-2007 17:43
http://oldforge.etsi.org/mantis/file_download.php?file_id=1245&type=bug
zip CR_416_v5.zip (886,077) 06-12-2007 18:30
http://oldforge.etsi.org/mantis/file_download.php?file_id=1247&type=bug
Issue History
24-11-2006 14:34Stephan SchulzNew Issue
24-11-2006 14:34Stephan SchulzClause Reference(s) => -
24-11-2006 14:34Stephan SchulzSource (company - Author) => dr. György Réthy, Ericsson
15-06-2007 19:15Stephan SchulzStatusnew => assigned
15-06-2007 19:15Stephan SchulzAssigned To => Ina Schieferdecker
13-10-2007 19:22Ina SchieferdeckerAssigned ToIna Schieferdecker => developer_u
17-10-2007 12:41user10Assigned Todeveloper_u => Thomas Deiß
18-10-2007 12:10Ina SchieferdeckerTarget Version => Edition 4.1.1 (not yet published)
06-12-2007 11:51Thomas DeißFile Added: CR_416_v2.zip
06-12-2007 11:52Thomas DeißNote Added: 0004372
06-12-2007 11:52Thomas DeißAssigned ToThomas Deiß => Gyorgy Rethy
06-12-2007 11:52Thomas DeißResolutionopen => fixed
06-12-2007 11:52Thomas DeißTarget VersionEdition 4.1.1 (not yet published) => Edition 3.3.1 (not yet published)
06-12-2007 16:59Thomas DeißNote Added: 0004396
06-12-2007 17:01Thomas DeißFile Added: CR_416_v3.zip
06-12-2007 17:43Gyorgy RethyFile Added: CR_416_v4.zip
06-12-2007 17:45Gyorgy RethyNote Added: 0004401
06-12-2007 17:45Gyorgy RethyAssigned ToGyorgy Rethy => Jens Grabowski
06-12-2007 18:05Jens GrabowskiAssigned ToJens Grabowski => Thomas Deiß
06-12-2007 18:30Thomas DeißFile Added: CR_416_v5.zip
06-12-2007 18:34Thomas DeißNote Added: 0004407
06-12-2007 18:34Thomas DeißAssigned ToThomas Deiß => Ina Schieferdecker
07-12-2007 09:38Ina SchieferdeckerStatusassigned => resolved
07-12-2007 10:05Ina SchieferdeckerStatusresolved => closed
07-12-2007 10:05Ina SchieferdeckerNote Added: 0004417
07-12-2007 10:05Ina SchieferdeckerFixed in Version => Edition 3.3.1 (not yet published)
12-03-2008 10:22user10Fixed in VersionEdition 3.3.1 --will not be published, see 3.3.2 => Edition 3.3.2 (not yet published)
12-03-2008 10:24user10Target VersionEdition 3.3.1 --will not be published, see 3.3.2 => Edition 3.3.2 (not yet published)

Notes
(0004372)
Thomas Deiß   
06-12-2007 11:52   
solution provided (already checked by Gyorgy once)
(0004396)
Thomas Deiß   
06-12-2007 16:59   
New solution (R3). Introduce restrictions of templates, currently just one restriction is allowed (omit). 'template (omit)' can be shortened to omit. incorrect cases are not required to be detected at compile time, similar to type compatibility.
(0004401)
Gyorgy Rethy   
06-12-2007 17:45   
I basically agree both with the solution and handling it in the standard's text. Made some modifications to the text proposed.
(0004407)
Thomas Deiß   
06-12-2007 18:34   
Description made more restrictive (no hints on more general usage).
Example added.
Parentheses changed to curly brackets to avoid confusion with value lists.

please check the additional comments in the BNF.
(0004417)
Ina Schieferdecker   
07-12-2007 10:05   
just little wording changes