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

ID | Project | Category | View Status | Date Submitted | Last Update
0005808 | Part 01: TTCN-3 Core Language | Technical | public | 24-11-2010 12:11 | 01-12-2010 10:28

Reporter | Andras Kovacs |
Assigned To | Gyorgy Rethy |
Priority | normal | Severity | minor | Reproducibility | N/A
Status | closed | Resolution | no change required |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version |  | Fixed in Version |  |
Clause Reference(s) | [Part 1: TTCN-3 Core Language / Section 5.4.1 ]
Source (company - Author) | BroadBit - Andras Kovacs

Summary | 0005808: STF409 comment on [Part 1: TTCN-3 Core Language / Section 5.4.1 ]: inout parameters
Description | It is implied from the content of this section that there can be no default value for inout parameters, and furthermore the value of a referenced inout parameter must be always present in the corresponding call (i.e. no use of '-' assignment for inout parameter types). It would add much to the clarity of the standard if this restriction has been explicitly stated.
Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files |

Issue History
Date Modified | Username | Field | Change
24-11-2010 12:11 | Andras Kovacs | New Issue |
24-11-2010 12:11 | Andras Kovacs | Clause Reference(s) | => [Part 1: TTCN-3 Core Language / Section 5.4.1 ]
24-11-2010 12:11 | Andras Kovacs | Source (company - Author) | => BroadBit - Andras Kovacs
29-11-2010 09:56 | Jacob Wieland - Spirent | Note Added: 0009818 |
29-11-2010 10:40 | Gyorgy Rethy | Note Added: 0009819 |
29-11-2010 10:41 | Gyorgy Rethy | Note Added: 0009820 |
29-11-2010 10:41 | Gyorgy Rethy | Assigned To | => Jacob Wieland - Spirent
29-11-2010 10:41 | Gyorgy Rethy | Status | new => assigned
29-11-2010 12:54 | Jacob Wieland - Spirent | Note Added: 0009825 |
29-11-2010 13:04 | Jacob Wieland - Spirent | Relationship added | related to 0005513
29-11-2010 13:05 | Jacob Wieland - Spirent | Relationship deleted | related to 0005513
29-11-2010 13:10 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gyorgy Rethy
29-11-2010 13:56 | Gyorgy Rethy | Note Edited: 0009819 |
30-11-2010 09:34 | Ina Schieferdecker | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
01-12-2010 10:22 | Gyorgy Rethy | Note Added: 0009880 |
01-12-2010 10:28 | Gyorgy Rethy | Status | assigned => closed
01-12-2010 10:28 | Gyorgy Rethy | Resolution | open => no change required

Notes

(0009818)
Jacob Wieland - Spirent
29-11-2010 09:56

Default values to inout parameters does not make sense as these parameters are always instantiated with VARIABLES and since there are no global variables, no such variable can be supplied in the formal parameter declaration.
However, I think allowing the unchanged symbol as instantiation for for out parameters (with the meaning that the resulting value of the out-parameter after the call is not assigned to any variable) would make sense.
For example:
function splitQualifiedName(in charstring qualifiedName, out charstring moduleName, out charstring declName) {
...
moduleName := ...;
declName := ...;
...
}
function charstring getDeclarationName(in charstring qualifiedName) return charstring {
var charstring result;
splitQualifiedName(qualifiedName, -, result);
return result;
}
It could even be possible to allow leaving out the rest of the parameter list (the same as for in-parameters) if all the rest-parameters are 'unchanged'.
function charstring getModuleName(in charstring qualifiedName) return charstring {
var charstring result;
splitQualifiedName(qualifiedName, result);
return result;
}
Now, allowing default values for inout parameters could then have the meaning that when a function call passes the unchanged symbol to such a parameter, it is treates as if a variable that contains that value was passed to the parameter and assignment to that parameter won't have any effect to the calling function (like for an out parameter).
This would be a consistent and useful generalization of the default-value/unchanged-parameter feature.

(0009819)
Gyorgy Rethy
29-11-2010 10:40 (edited on: 29-11-2010 13:56)

STF409 didn't asked to extend default values to inout or out parameters, just to add a sentence to state *explicitly*, that default value is not allowed for these kinds of parameters. Currently the standard states in
$5.4.1 "Formal in parameters may have default values. This default value is used when no actual parameter is provided." and in
$5.4.1.1 "In parameters may have a default value, which is given by an expression assigned to the parameter.".
I simply propose to add the sentence to $5.4.1 (following the existing two sentences)
"Inout and out parameters shall have no default value."

(0009820)
Gyorgy Rethy
29-11-2010 10:41

Assigned to Jacob on my own, to check my proposal.

(0009825)
Jacob Wieland - Spirent
29-11-2010 12:54

Your proposal is fine, but I think totally unnecessary.
Since the feature 'default value' is only introduced in the context of in parameters, I don't think that it needs to be forbidden for other kinds of parameters for which it was never introduced.
So, your proposal just adds (in my view unncessecary) redundancy (which later can lead to inconsistencies should the feature be enlarged to encompass other kinds of parameters as well).
It's like saying: Strings can be concatenated with the concatenation operator. Integers cannot be concatenated with the concatenation operator.
Restrictions should only be added where not having the restriction would have any meaningful semantics but which is problematic for some reason. Otherwise, the restriction should be unnecessary.

(0009880)
Gyorgy Rethy
01-12-2010 10:22

OK. Clarifying the question in this CR should be enough, default values are allowed for "in" parameters only. No change in the standard's text.