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

ID | Project | Category | View Status | Date Submitted | Last Update
0002152 | Part 01: TTCN-3 Core Language | Clarification | public | 15-10-2007 13:44 | 09-12-2008 16:29

Reporter | Gyorgy Rethy |
Assigned To | Ina Schieferdecker |
Priority | normal | Severity | minor | Reproducibility | always
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version | v4.1.1 (published 2009-06) | Fixed in Version | v4.1.1 (published 2009-06) |
Clause Reference(s) | $10
Source (company - Author) |

Summary | 0002152: Initialisation of constants using internal/external functions

Description

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.

Steps To Reproduce |

Additional Information

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â€¦).

Tags | No tags attached.

Relationships

related to | 0004270 | closed | Ina Schieferdecker | Initialization expressions within component types

Attached Files

CR2152_SolutionOutline.doc (39,424) 13-03-2008 15:02
http://oldforge.etsi.org/mantis/file_download.php?file_id=1378&type=bug
es_20187301v040100_CR2152.zip (874,214) 13-03-2008 15:06
http://oldforge.etsi.org/mantis/file_download.php?file_id=1379&type=bug
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
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
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
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
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
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
Date Modified | Username | Field | Change
15-10-2007 13:44 | Gyorgy Rethy | New Issue |
15-10-2007 13:44 | Gyorgy Rethy | Status | new => assigned
15-10-2007 13:44 | Gyorgy Rethy | Assigned To | => Gyorgy Rethy
15-10-2007 13:44 | Gyorgy Rethy | Clause Reference(s) | => $10
15-10-2007 13:44 | Gyorgy Rethy | Source (company - Author) | =>
15-10-2007 19:36 | Ina Schieferdecker | Assigned To | Gyorgy Rethy => developer_u
17-10-2007 12:42 | user10 | Assigned To | developer_u => Thomas DeiÃŸ
18-10-2007 13:44 | Ina Schieferdecker | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
18-10-2007 13:57 | Ina Schieferdecker | Target Version | => Edition 3.3.1 (not yet published)
03-12-2007 12:28 | Jens Grabowski | Note Added: 0004226 |
03-12-2007 12:29 | Jens Grabowski | Target Version | Edition 3.3.1 (not yet published) => Edition 4.1.1 (not yet published)
12-03-2008 14:45 | Ina Schieferdecker | Assigned To | Thomas DeiÃŸ => Ina Schieferdecker
13-03-2008 15:02 | Ina Schieferdecker | File Added: CR2152_SolutionOutline.doc |
13-03-2008 15:06 | Ina Schieferdecker | File Added: es_20187301v040100_CR2152.zip |
13-03-2008 15:06 | Ina Schieferdecker | Assigned To | Ina Schieferdecker => Thomas DeiÃŸ
21-04-2008 08:51 | Ina Schieferdecker | Target Version | Edition 4.1.1 (not yet published) => Edition 3.4.1 (not yet published)
25-04-2008 13:05 | Ina Schieferdecker | Note Added: 0005580 |
25-04-2008 13:06 | Ina Schieferdecker | File Added: es_20187301v040000_CR2152_v2.zip |
25-04-2008 13:07 | Ina Schieferdecker | Target Version | Edition 3.4.1 (not yet published) => Edition 4.1.1 (not yet published)
25-04-2008 13:07 | Ina Schieferdecker | Assigned To | Thomas DeiÃŸ => Gyorgy Rethy
14-08-2008 13:46 | Ina Schieferdecker | File Added: es_20187301v040000_CR2152_v3.zip |
14-08-2008 13:47 | Ina Schieferdecker | Note Added: 0006530 |
14-08-2008 15:24 | Gyorgy Rethy | File Added: es_20187301v040000_CR2152_v4.zip |
14-08-2008 15:30 | Gyorgy Rethy | Note Added: 0006536 |
14-08-2008 15:30 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
15-08-2008 09:22 | Ina Schieferdecker | Note Added: 0006540 |
15-08-2008 09:22 | Ina Schieferdecker | Status | assigned => resolved
15-08-2008 09:22 | Ina Schieferdecker | Resolution | open => fixed
15-08-2008 09:22 | Ina Schieferdecker | Fixed in Version | => Edition 4.1.1 (not yet published)
17-08-2008 10:00 | Ina Schieferdecker | Note Edited: 0006540 |
17-08-2008 10:01 | Ina Schieferdecker | File Added: es_20187301v040000_CR2152_v5.zip |
17-08-2008 10:02 | Ina Schieferdecker | Assigned To | Ina Schieferdecker => Gyorgy Rethy
17-08-2008 10:02 | Ina Schieferdecker | Status | resolved => assigned
18-09-2008 04:06 | Thomas DeiÃŸ | Note Added: 0006834 |
25-11-2008 10:26 | Ina Schieferdecker | Relationship added | related to 0004270
25-11-2008 13:50 | Gyorgy Rethy | Note Added: 0007411 |
25-11-2008 13:51 | Gyorgy Rethy | File Added: es_20187301v040000_CR2152_v6.zip |
25-11-2008 13:51 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Ina Schieferdecker
26-11-2008 08:58 | Thomas DeiÃŸ | File Added: CR4270_ConstantsInTypes_v2.doc |
26-11-2008 08:58 | Thomas DeiÃŸ | File Deleted: CR4270_ConstantsInTypes_v2.doc |
26-11-2008 08:59 | Thomas DeiÃŸ | File Added: es_20187301v040000_CR2152_v7.zip |
26-11-2008 09:00 | Thomas DeiÃŸ | Note Added: 0007438 |
27-11-2008 13:26 | Thomas DeiÃŸ | Note Added: 0007470 |
09-12-2008 16:28 | Ina Schieferdecker | Status | assigned => resolved
09-12-2008 16:29 | Ina Schieferdecker | Status | resolved => 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.