ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details
0002152Part 01: TTCN-3 Core LanguageClarificationpublic15-10-2007 13:4409-12-2008 16:29
Gyorgy Rethy 
Ina Schieferdecker 
normalminoralways
closedfixed 
 
v4.1.1 (published 2009-06)v4.1.1 (published 2009-06) 
$10
     
0002152: Initialisation of constants using internal/external functions
According to the current version of the TTCN-3 spec, functions are not allowed for initialisation of constants. Nevertheless some compilers allow even external functions. On the other hand at least build-in functions seem to be useful within constant definitions (e.g. to initialise long bitstrings with ‘0’). Also the usage of TTCN-3 functions considering restrictions according to clause 16.1.4 “Restrictions for functions called from specific places” seem to be suitable.
Anyway it would be helpful to give examples of constant definitions to illustrate what shall be allowed and what is not allowed.
Compilers should generate at least a warning, when a constant declaration contains not allowed parts.
The TTCN-3 standard core language is stating that the constant value shall be known at compile time. While this may be a clear requirement for compiler experts, may not be sufficient for most of the users. It shall explicitly be stated that in constant expressions only the following elements are allowed:
• literal values,
• constants,
• predefined conversion functions (int2unichar, int2bit, int2hex, int2oct, int2str, int2float, float2int, char2int, char2oct, unichar2int, bit2int, bit2hex, bit2oct, bit2str, hex2int, hex2bit, hex2oct, hex2str, oct2int, oct2bit, oct2hex, oct2str, oct2char, str2int, str2oct, str2float), provided all their parameters are either literal values or constants;
• predefined functions lengthof, sizeof, ispresent, ischosen, regexp, substr, replace and (decomp) provided their parameters are either literal values or constants.

Thus, the predefined functions rnd and sizeoftype are not allowed. In principle, valueof could be considered BUT we think the gained feature does NOT pays of the complexity of the implementation (valueof non-parameterized templates that are using at maximum the above predefined functions and other non-parameterized templates or templates parameterized with literal or constant values and again using…).
No tags attached.
related to 0004270closed Ina Schieferdecker Initialization expressions within component types 
doc CR2152_SolutionOutline.doc (39,424) 13-03-2008 15:02
http://oldforge.etsi.org/mantis/file_download.php?file_id=1378&type=bug
zip es_20187301v040100_CR2152.zip (874,214) 13-03-2008 15:06
http://oldforge.etsi.org/mantis/file_download.php?file_id=1379&type=bug
zip es_20187301v040000_CR2152_v2.zip (875,567) 25-04-2008 13:06
http://oldforge.etsi.org/mantis/file_download.php?file_id=1461&type=bug
zip es_20187301v040000_CR2152_v3.zip (874,114) 14-08-2008 13:46
http://oldforge.etsi.org/mantis/file_download.php?file_id=1601&type=bug
zip es_20187301v040000_CR2152_v4.zip (851,675) 14-08-2008 15:24
http://oldforge.etsi.org/mantis/file_download.php?file_id=1604&type=bug
zip es_20187301v040000_CR2152_v5.zip (878,202) 17-08-2008 10:01
http://oldforge.etsi.org/mantis/file_download.php?file_id=1611&type=bug
zip es_20187301v040000_CR2152_v6.zip (859,685) 25-11-2008 13:51
http://oldforge.etsi.org/mantis/file_download.php?file_id=1777&type=bug
zip es_20187301v040000_CR2152_v7.zip (881,332) 26-11-2008 08:59
http://oldforge.etsi.org/mantis/file_download.php?file_id=1787&type=bug
Issue History
15-10-2007 13:44Gyorgy RethyNew Issue
15-10-2007 13:44Gyorgy RethyStatusnew => assigned
15-10-2007 13:44Gyorgy RethyAssigned To => Gyorgy Rethy
15-10-2007 13:44Gyorgy RethyClause Reference(s) => $10
15-10-2007 13:44Gyorgy RethySource (company - Author) =>
15-10-2007 19:36Ina SchieferdeckerAssigned ToGyorgy Rethy => developer_u
17-10-2007 12:42user10Assigned Todeveloper_u => Thomas Deiß
18-10-2007 13:44Ina SchieferdeckerProjectTTCN-3 Change Requests => Part 01: TTCN-3 Core Language
18-10-2007 13:57Ina SchieferdeckerTarget Version => Edition 3.3.1 (not yet published)
03-12-2007 12:28Jens GrabowskiNote Added: 0004226
03-12-2007 12:29Jens GrabowskiTarget VersionEdition 3.3.1 (not yet published) => Edition 4.1.1 (not yet published)
12-03-2008 14:45Ina SchieferdeckerAssigned ToThomas Deiß => Ina Schieferdecker
13-03-2008 15:02Ina SchieferdeckerFile Added: CR2152_SolutionOutline.doc
13-03-2008 15:06Ina SchieferdeckerFile Added: es_20187301v040100_CR2152.zip
13-03-2008 15:06Ina SchieferdeckerAssigned ToIna Schieferdecker => Thomas Deiß
21-04-2008 08:51Ina SchieferdeckerTarget VersionEdition 4.1.1 (not yet published) => Edition 3.4.1 (not yet published)
25-04-2008 13:05Ina SchieferdeckerNote Added: 0005580
25-04-2008 13:06Ina SchieferdeckerFile Added: es_20187301v040000_CR2152_v2.zip
25-04-2008 13:07Ina SchieferdeckerTarget VersionEdition 3.4.1 (not yet published) => Edition 4.1.1 (not yet published)
25-04-2008 13:07Ina SchieferdeckerAssigned ToThomas Deiß => Gyorgy Rethy
14-08-2008 13:46Ina SchieferdeckerFile Added: es_20187301v040000_CR2152_v3.zip
14-08-2008 13:47Ina SchieferdeckerNote Added: 0006530
14-08-2008 15:24Gyorgy RethyFile Added: es_20187301v040000_CR2152_v4.zip
14-08-2008 15:30Gyorgy RethyNote Added: 0006536
14-08-2008 15:30Gyorgy RethyAssigned ToGyorgy Rethy => Ina Schieferdecker
15-08-2008 09:22Ina SchieferdeckerNote Added: 0006540
15-08-2008 09:22Ina SchieferdeckerStatusassigned => resolved
15-08-2008 09:22Ina SchieferdeckerResolutionopen => fixed
15-08-2008 09:22Ina SchieferdeckerFixed in Version => Edition 4.1.1 (not yet published)
17-08-2008 10:00Ina SchieferdeckerNote Edited: 0006540
17-08-2008 10:01Ina SchieferdeckerFile Added: es_20187301v040000_CR2152_v5.zip
17-08-2008 10:02Ina SchieferdeckerAssigned ToIna Schieferdecker => Gyorgy Rethy
17-08-2008 10:02Ina SchieferdeckerStatusresolved => assigned
18-09-2008 04:06Thomas DeißNote Added: 0006834
25-11-2008 10:26Ina SchieferdeckerRelationship addedrelated to 0004270
25-11-2008 13:50Gyorgy RethyNote Added: 0007411
25-11-2008 13:51Gyorgy RethyFile Added: es_20187301v040000_CR2152_v6.zip
25-11-2008 13:51Gyorgy RethyAssigned ToGyorgy Rethy => Ina Schieferdecker
26-11-2008 08:58Thomas DeißFile Added: CR4270_ConstantsInTypes_v2.doc
26-11-2008 08:58Thomas DeißFile Deleted: CR4270_ConstantsInTypes_v2.doc
26-11-2008 08:59Thomas DeißFile Added: es_20187301v040000_CR2152_v7.zip
26-11-2008 09:00Thomas DeißNote Added: 0007438
27-11-2008 13:26Thomas DeißNote Added: 0007470
09-12-2008 16:28Ina SchieferdeckerStatusassigned => resolved
09-12-2008 16:29Ina SchieferdeckerStatusresolved => closed

Notes
(0004226)
Jens Grabowski   
03-12-2007 12:28   
Cannot be fixed in Version 3.3.1. Either test suites are invalidated or requires major changes in part 1 and part 4.
(0005580)
Ina Schieferdecker   
25-04-2008 13:05   
We propose to ease the constant handling by making constants run-time constants in general and to impose compile-time constant limitations only for those constants which are used in type definitions.
(0006530)
Ina Schieferdecker   
14-08-2008 13:47   
One more run through the resolution: the external contant BNF productions have to be kept - external constants are deprecated only.
(0006536)
Gyorgy Rethy   
14-08-2008 15:30   
There are some changes of the wording in ~v4, to be cross-checked.
(0006540)
Ina Schieferdecker   
15-08-2008 09:22   
(edited on: 17-08-2008 10:00)
See resolution v5:

Extended sentence for clause 6.2.7 Arrays: "Constants used in the constant expressions shall meet with the restrictions in clause 10, see in particular restriction c)"

Restr. g in 8.2.1: "g) Module parameters shall not be used in type or array definitions."

Constant explaination in 10: "A value is assigned only once to a constant, which does not change its value during test execution."

(0006834)
Thomas Deiß   
18-09-2008 04:06   
clause 10, restriction b) The value of the ConstantExpression assigned to a constant shall be of the same type as the stated type for the constants.

Isn't this too strict? Compatibility of the value with the type of the constant would be sufficient.
(0007411)
Gyorgy Rethy   
25-11-2008 13:50   
Deleted "dynamic" from 1st sentence of clause 10. Added, that constants shall be initialized at declaration to the "semantic description". BNF rule 576: static semantic rule is removed. My changes are in es_20187301v040000_CR2152_v6.zip. Otherwise OK with me.
(0007438)
Thomas Deiß   
26-11-2008 09:00   
one typo found.
restriction that expression to initialize constant has to be of the same type removed. This is obvious.
v7 uploaded.
(0007470)
Thomas Deiß   
27-11-2008 13:26   
Clause 6.2.1 contains the following sentence (end of first paragraph)

"A constant that is of record type shall contain no variables or module parameters as field values, either directly or indirectly."

This will be too strict. How a constant can be initialized will be defined anyway. This specific sentence can be removed.