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

ID | Project | Category | View Status | Date Submitted | Last Update
0008090 | Part 01: TTCN-3 Core Language | New Feature | public | 23-03-2022 15:43 | 26-01-2024 16:24

Reporter | Matthias Simon |
Assigned To | Jens Grabowski |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | won't fix |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version |  | Fixed in Version |  |
Clause Reference(s) | C.2.1 Length of strings and lists
Source (company - Author) | Nokia - Matthias Simon

Summary | 0008090: Deprecate `lengthof` in favor of `length`

Description

I often accidentally use keyword `length` instead of predefined function `lengthof`. The result is an irritating syntax error ala `unexpected length, expecting expression`.
This mistake is easy to make. Hence I propose to rename predefined function `lengthof` to `length`. And begin deprecation process for the `lengthof` keyword.
This would become valid TTCN-3 code:
for (i := 0; i < length('1100101'b); i := i + 1) { /* ... */ }

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files |

Issue History
Date Modified | Username | Field | Change
23-03-2022 15:43 | Matthias Simon | New Issue |
16-08-2022 14:17 | Jens Grabowski | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
17-08-2022 11:02 | Jens Grabowski | Note Added: 0016233 |
17-08-2022 11:02 | Jens Grabowski | Assigned To | => Tomas Urban
17-08-2022 11:02 | Jens Grabowski | Status | new => assigned
09-11-2022 10:42 | Tomas Urban | Note Added: 0016272 |
09-11-2022 11:56 | Matthias Simon | Note Added: 0016277 |
09-11-2022 12:35 | Jens Grabowski | Note Added: 0016278 |
09-11-2022 12:36 | Jens Grabowski | Assigned To | Tomas Urban => Jens Grabowski
09-11-2023 11:24 | Jens Grabowski | Note Added: 0016566 |
09-11-2023 11:24 | Jens Grabowski | Status | assigned => closed
09-11-2023 11:24 | Jens Grabowski | Resolution | open => won't fix
26-01-2024 16:24 | Olivier Genoud | Note Added: 0016604 |

Notes

(0016233)
Jens Grabowski
17-08-2022 11:02

TTF discussion: Similar argumentation as for operators. Needs to be studied. There might be a potential grammer conflict.

(0016272)
Tomas Urban
09-11-2022 10:42

Input for a discussion:
The proposed change is technically possible, there are no grammar conflicts. Unfortunately it is not so straightforward. As "length" is one of the keywords, it is not possible to keep this statement in the category of predefined functions and it has to be changed to a unary expression operator. There were similar changes of this type in the past (e.g. isvalue), but the reasons were different - these function calls required specific handling for parameters which differed from standard function calls. This time we are dealing just with naming.
There are two minor drawbacks when changing a predefined function into an operator:
1. The function can no-longer be used as an standalone statement (irrelevant in case of lengthof as a standalone lengthof call does nothing).
2. Impossibility to use function pointers with lengthof (this functionality is specified in an extension package, extremely unlikely option)
I can prepare a proposal but I need an approval of the TTF for this kind of change.

(0016277)
Matthias Simon
09-11-2022 11:56

> it is not possible to keep this statement in the category of predefined functions Why can't predefined functions with a reserved name be a statement? I would have excepted the situation is similar to predefined type or builtin functions like `log` oder `match`.

(0016278)
Jens Grabowski
09-11-2022 12:35

TTF discussion: CR is postponed and should become part of a larger discussion about the further development of the standard.

(0016566)
Jens Grabowski
09-11-2023 11:24

CR is postponed and should become part of a larger discussion. CR will become part of CR 8180.

(0016604)
Olivier Genoud
26-01-2024 16:24

This change is non-backwards compatible, so it would need a grace period in which "lengthof" still needs to be supported by TTCN-3 tools. On the other hand, there seems to be no technical benefit, "lengthof" and "length" are different things, so why shall they have the same name? => TF160 does not support this proposal.