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

ID | Project | Category | View Status | Date Submitted | Last Update
0006697 | Part 01: TTCN-3 Core Language | New Feature | public | 06-03-2014 10:51 | 28-07-2014 14:11

Reporter | Wolfgang Seka |
Assigned To | Gyorgy Rethy |
Priority | urgent | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.6.1 (published 2014-06) |
Target Version | v4.6.2 (interim 2014) | Fixed in Version | v4.6.2 (interim 2014) |
Clause Reference(s) | ES 201 873-1 C.3
Source (company - Author) | MCC160 - Wolfgang

Summary | 0006697: Missing functionality to check absence of an object
Description | There are several functions to check presence of an object but there is no way to check whether an object omit: e.g. isomitted. NOTE: "isomitted(inpar)" would not be the same as "not ispresent(inpar)" as in case of "var template MyType v_MyType := *" both functions would result in false.
Steps To Reproduce |
Additional Information | Use case: The "isomitted" functionality is helpful e.g. for SIP when you want to construct a message which may or may not have a message body (i.e. parameter is either omit or a template); in case of the message body being present the message needs to have a Content-Type.
Tags | No tags attached.

Relationships

related to | 0006736 | closed | Gyorgy Rethy | new matching mechanism for binary string types

Attached Files

CR6697_v1.docx (26,820) 10-04-2014 12:56
http://oldforge.etsi.org/mantis/file_download.php?file_id=2994&type=bug
CR6697_v2.docx (27,067) 18-04-2014 10:27
http://oldforge.etsi.org/mantis/file_download.php?file_id=3022&type=bug
CR6697_v3.docx (39,617) 17-06-2014 16:50
http://oldforge.etsi.org/mantis/file_download.php?file_id=3040&type=bug
CR6697_v4.docx (47,746) 01-07-2014 16:41
http://oldforge.etsi.org/mantis/file_download.php?file_id=3077&type=bug
CR6697_v5.docx (47,549) 11-07-2014 13:41
http://oldforge.etsi.org/mantis/file_download.php?file_id=3078&type=bug

Issue History
Date Modified | Username | Field | Change
06-03-2014 10:51 | Wolfgang Seka | New Issue |
08-04-2014 08:52 | Gyorgy Rethy | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
08-04-2014 09:27 | Gyorgy Rethy | Note Added: 0011948 |
08-04-2014 09:28 | Gyorgy Rethy | Assigned To | => Jens Grabowski
08-04-2014 09:28 | Gyorgy Rethy | Status | new => assigned
08-04-2014 09:28 | Gyorgy Rethy | Product Version | => v4.6.1 (published 2014-06)
08-04-2014 09:28 | Gyorgy Rethy | Target Version | => v4.7.1 (published 2015-06)
08-04-2014 10:09 | Wolfgang Seka | Note Added: 0011951 |
09-04-2014 12:38 | Gyorgy Rethy | Priority | normal => urgent
10-04-2014 10:01 | Gyorgy Rethy | Assigned To | Jens Grabowski => Tomas Urban
10-04-2014 10:06 | Gyorgy Rethy | Note Added: 0011986 |
10-04-2014 10:07 | Jacob Wieland - Spirent | Note Added: 0011987 |
10-04-2014 11:26 | Tomas Urban | Note Added: 0011991 |
10-04-2014 12:56 | Tomas Urban | File Added: CR6697_v1.docx |
10-04-2014 12:57 | Tomas Urban | Note Added: 0011999 |
10-04-2014 12:57 | Tomas Urban | Assigned To | Tomas Urban => Jens Grabowski
10-04-2014 12:57 | Tomas Urban | Status | assigned => confirmed
18-04-2014 10:27 | Gyorgy Rethy | Note Added: 0012042 |
18-04-2014 10:27 | Gyorgy Rethy | File Added: CR6697_v2.docx |
18-04-2014 10:28 | Gyorgy Rethy | Assigned To | Jens Grabowski => Tomas Urban
18-04-2014 10:28 | Gyorgy Rethy | Status | confirmed => assigned
18-04-2014 10:28 | Gyorgy Rethy | Note Edited: 0012042 | bug_revision_view_page.php?bugnote_id=12042#r18
18-04-2014 10:29 | Gyorgy Rethy | Note Edited: 0012042 | bug_revision_view_page.php?bugnote_id=12042#r19
22-04-2014 08:34 | Jacob Wieland - Spirent | Note Added: 0012044 |
22-04-2014 09:30 | Tomas Urban | Note Added: 0012045 |
22-04-2014 11:08 | Jacob Wieland - Spirent | Note Added: 0012046 |
22-04-2014 12:09 | Tomas Urban | Note Added: 0012047 |
22-04-2014 12:28 | Jacob Wieland - Spirent | Note Added: 0012048 |
16-06-2014 10:18 | Tomas Urban | Note Added: 0012077 |
17-06-2014 15:56 | Gyorgy Rethy | Target Version | v4.7.1 (published 2015-06) => v4.6.2 (interim 2014)
17-06-2014 16:50 | Tomas Urban | File Added: CR6697_v3.docx |
17-06-2014 16:57 | Tomas Urban | Note Added: 0012111 |
17-06-2014 16:57 | Tomas Urban | Assigned To | Tomas Urban => Gyorgy Rethy
17-06-2014 16:57 | Tomas Urban | Status | assigned => confirmed
17-06-2014 16:57 | Tomas Urban | Relationship added | related to 0006736
18-06-2014 20:07 | Jacob Wieland - Spirent | Note Added: 0012135 |
01-07-2014 16:41 | Gyorgy Rethy | File Added: CR6697_v4.docx |
01-07-2014 16:43 | Gyorgy Rethy | Note Added: 0012199 |
01-07-2014 16:44 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Tomas Urban
02-07-2014 07:47 | Tomas Urban | Note Added: 0012200 |
03-07-2014 07:36 | Jacob Wieland - Spirent | Note Added: 0012201 |
11-07-2014 13:41 | Gyorgy Rethy | File Added: CR6697_v5.docx |
11-07-2014 13:48 | Gyorgy Rethy | Note Added: 0012202 |
11-07-2014 13:48 | Gyorgy Rethy | Status | confirmed => resolved
11-07-2014 13:48 | Gyorgy Rethy | Fixed in Version | => v4.6.2 (interim 2014)
11-07-2014 13:48 | Gyorgy Rethy | Resolution | open => fixed
11-07-2014 13:48 | Gyorgy Rethy | Assigned To | Tomas Urban => Gyorgy Rethy
28-07-2014 14:11 | Gyorgy Rethy | Note Added: 0012204 |
28-07-2014 14:11 | Gyorgy Rethy | Status | resolved => closed

Notes

(0011948)
Gyorgy Rethy
08-04-2014 09:27

not ispresent(object) and isvalue (object) could solve the problem.

(0011951)
Wolfgang Seka
08-04-2014 10:09

Example:
var template MyType v_MyTemplateVariable1 := cr_MyTemplate;
var template MyType v_MyTemplateVariable2 := cr_MyTemplate ifpresent;
var template MyType v_MyTemplateVariable3 := *;
var template MyType v_MyTemplateVariable4 := omit;
=> acc. to my understanding
ispresent returns true for v_MyTemplateVariable1 only but returns false for v_MyTemplateVariable[2..4];
isvalue may return true for v_MyTemplateVariable1 but returns false for v_MyTemplateVariable[2..4];
What is interesting for us is to identify v_MyTemplateVariable4 being explicitly set to omit.

(0011986)
Gyorgy Rethy
10-04-2014 10:06

STF discussion: most widely use-able way would be to convert templates to charstrings; in this case simply a ttnc2char(t_Mytemplate) == "omit"; would give the requested feature.

(0011987)
Jacob Wieland - Spirent
10-04-2014 10:07

What is wrong with x == omit? That is allowed by now, is it not?

(0011991)
Tomas Urban
10-04-2014 11:26

Comparison with omit is not allowed for two reasons, according to restriction 7.a: 1) Templates cannot be operands of expression 2) Operands of expressions have to be completely initialized values and omit is not a value

(0011999)
Tomas Urban
10-04-2014 12:57

Definition of the proposed ttcn2char function attached. Please check.

(0012042)
Gyorgy Rethy
18-04-2014 10:27 (edited on: 18-04-2014 10:29)

A few comments (see CR6697_v2.docx):
- the <something>2char functions are converting <something> to its character equivalents, e.g. int2char the character codepoint in ISO646 to the character (int2char(65) == "A"); this function will not convert, just print out the content;
- the <something>2str functions do simply print out the content into a charstring. Therefore I propose that the name of the predef. function should be ttcn2str.
-> changed in CR6697_v2.docx
- I haven't found a description on how to present matching symbols in textual form; in tliLog for example the whole "data" to be logged is a string, i.e. the internal format seems to be tool specific; to allow using simple strings instead of patterns, when checking the content, we should specify the exact format, e.g. in "-1 ifpresent" there shall be exactly 1 space between "-1" and "ifpresent" (do you agree?);
-> not defined in CR6697_v2.docx, just the ifpresent example has been added.
- the function should accept uninitialized, partly and completely initialized input (at different places it was defined differently)
-> corrected in CR6697_v2.docx

(0012044)
Jacob Wieland - Spirent
22-04-2014 08:34

Sorry, I am very sure that the restriction of value-only has been lifted for the equality operator. Please check again in the standard in the section about the equality operation.

(0012045)
Tomas Urban
22-04-2014 09:30

I am sorry, but I am not aware of any rule allowing templates as operands of the equality operator. The rules of the section 7.1.3 allow values only:
Operands of equality (==) and non-equality (!=) shall be completely initialized values or field references of type compatible root types and the values or field references being compared shall obey the following rules. This implies that instances of types not mentioned below shall not be operands of equality and non-equality.
Two field references are equal if the referenced fields are both optional fields and both fields are set to omit or if both referenced fields (regardless if they are optional or not) are initialized with values and these values are equal. A field reference is equal to a value if the referenced field is initialized with a value and both values are equal.

(0012046)
Jacob Wieland - Spirent
22-04-2014 11:08

Well, as you are probably aware, this allows fields that are omit to be compared with values (yields false) or with other fields that are omit (yields true). So, since template(omit) variables/parameters are only stand-ins for field references (either they are assigned a field reference or are used to be assigned to a field reference at some point), it stands to reason that comparing them with omit makes as much sense as comparing a field reference with omit (or with another field reference that is omitted).
Basically, it makes no sense whatsoever to treat a field reference that COULD be omit any differently than omit or a template with omit-restriction.

(0012047)
Tomas Urban
22-04-2014 12:09

Jacob, I understand your point, but this is a problem of semantics. Although template(omit) and template(value) are restricted in such a way that their content is a value (or omit), they are still not values in the sense of definition of value specified in the section 3.1.
Then there's a problem of the omit symbol itself. According to the definition of its use specified in the section 5, omit is a symbol used for omission of fields. It is not a value and as such it doesn't fulfil semantic requirements on operands of the equality operation.
However, all I wrote is just my interpretation of the rules. Since it seems that your interpretation is rather different, I think we need a CR to handle this situation explicitly in the standard. Could you please enter one?

(0012048)
Jacob Wieland - Spirent
22-04-2014 12:28

Okay, done, but this still does not solve the problem to check whether a non-restricted template is omit. I don't like the string-solution AT ALL. Sure, a to-string operation for templates is a nice thing to have, but we should not encourage people to use it for this intended purpose as that is just a dirty hack/workaround, in my opinion.

(0012077)
Tomas Urban
16-06-2014 10:18

I think this issue should be discussed again. I admit that Jacob's position comparing the proposed solution to a dirty hack is a relevant one and well-written code should not use it.
Maybe we should get back to the original proposal or specify a more general function istemplatekind() with two parameters (template, template kind) that would return true if the matching symbol is of certain kind and false otherwise:
var template integer vt_1 := ?, vt_2 := (0..2) ifpresent;
var boolen v_res;
...
v_res := istemplatekind(vt_1, "AnyValue"); // true
v_res := istemplatekind(vt_1, "AnyValueOrNone"); // false
v_res := istemplatekind(vt_2, "complement"); // false
v_res := istemplatekind(vt_2, "list"); // true
v_res := istemplatekind(vt_2, "ifpresent"); // true
Another option would be to allow using matching symbols and templates as operands of the equality operations and define the rules for this kind of comparison.
Both proposed solutions can be actually implemented together with the ttcn2char function which might be actually handy in some cases. I have one comment to this function as well: It should not return charstring, but universal charstring, since the converted template might contain universal string fields. In case it doesn't, universal charstring conversion to charstring is implicit, so the current functionality won't change.

(0012111)
Tomas Urban
17-06-2014 16:57

New proposal uploaded. The biggest change is addition of the new istemplatekind function. The description anticipites addidion of the new @encoded matching mechanism proposed in 0006736. If there are any changes in resolution of CR6736, the current proposal has to be updated accordingly.
I also change the return type and the name of the universal string conversion function from ttcn2str to any2unichar. The "any" part stands for the input parameter which is of "any type" and the second part stands for "universal charstring". So far all functions converting from/to universal charstring used unichar and it would be nice to follow the same naming convension.
Please check.

(0012135)
Jacob Wieland - Spirent
18-06-2014 20:07

Seems ok to me.

(0012199)
Gyorgy Rethy
01-07-2014 16:43

See CR6697_v4.docx. I have no significant technical comment, mainly the name of any2uni?. There are mostly editorial changes. Please re-review.

(0012200)
Tomas Urban
02-07-2014 07:47

Fine by me. I have no objections against changing the name to any2unistr.

(0012201)
Jacob Wieland - Spirent
03-07-2014 07:36

apart from a typo: ora should be "or a", I see no problem other than the term "the searched matching mechanism", I would replace it with "the matching mechanism kind queried for" - there is no search going on and the parameter is called "kind" which should make the text more clear.

(0012202)
Gyorgy Rethy
11-07-2014 13:48

Changed acc. to Jacob's comment (minor change that "enquired" is used instead of "requested for" as a one-word synonym reads better)

(0012204)
Gyorgy Rethy
28-07-2014 14:11

Added to master copy of V4.6.2 (interim 2014)