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

ID | Project | Category | View Status | Date Submitted | Last Update
0007624 | Part 01: TTCN-3 Core Language | New Feature | public | 07-03-2017 11:02 | 30-12-2017 17:20

Reporter | Jacob Wieland - Spirent |
Assigned To | Gyorgy Rethy |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.9.1 (published 2017-05) |
Target Version | v4.10.1 (published 2018-05) | Fixed in Version | v4.10.1 (published 2018-05) |
Clause Reference(s) | A.1.6.1.4
Source (company - Author) | Spirent - Jacob Wieland

Summary | 0007624: Local declarations should be allowed to be declared everywhere in a statement block

Description

The current situation that a statement block has first a sequence of declarations and then a sequence of non-declaration statements should be changed so that a statement block shall consist of a sequence of declaration and non-declaration statements with the other restrictions as before (i.e. that you can not forward-reference an entity that is declared textually after the reference).
The reason for this is harmonization with other languages. Modern programming languages allow declaration anywhere and ofttimes it makes code more clear to read if the declared item is declared textually close to its usage.
It would also make the usage of constants more flexible. Constants need to be initialized in their declaration, therefore all information for that initialization must be available already at the place of the declaration. If the value is dependent on some behavior before the usage of the constant, this can pose problems at the moment (leading to workarounds that you need a helper-function to compute the const-initialization-value).

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files | CR7624-1.docx (44,390) 08-06-2017 15:55 http://oldforge.etsi.org/mantis/file_download.php?file_id=3610&type=bug CR7624-2.docx (36,423) 09-06-2017 09:43 http://oldforge.etsi.org/mantis/file_download.php?file_id=3627&type=bug

Issue History
Date Modified | Username | Field | Change
07-03-2017 11:02 | Jacob Wieland - Spirent | New Issue |
07-03-2017 11:03 | Jacob Wieland - Spirent | Summary | Variables should be allowed to be declared everywhere in a statement block (instead of a statement) => Local declarations should be allowed to be declared everywhere in a statement block
19-04-2017 15:02 | szabados | Note Added: 0014588 |
19-04-2017 15:16 | Jacob Wieland - Spirent | Note Added: 0014589 |
06-06-2017 12:15 | Jens Grabowski | Note Added: 0014625 |
06-06-2017 12:15 | Jens Grabowski | Assigned To | => Tomas Urban
06-06-2017 12:15 | Jens Grabowski | Status | new => assigned
07-06-2017 09:12 | Tomas Urban | Note Added: 0014638 |
08-06-2017 15:55 | Tomas Urban | File Added: CR7624-1.docx |
08-06-2017 15:56 | Tomas Urban | Note Added: 0014655 |
08-06-2017 15:56 | Tomas Urban | Assigned To | Tomas Urban => Jacob Wieland - Spirent
08-06-2017 15:56 | Tomas Urban | Status | assigned => confirmed
09-06-2017 09:43 | Jacob Wieland - Spirent | File Added: CR7624-2.docx |
09-06-2017 09:44 | Jacob Wieland - Spirent | Status | confirmed => new
09-06-2017 09:44 | Jacob Wieland - Spirent | Note Added: 0014687 |
09-06-2017 09:44 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => KristÃ³f Szabados
09-06-2017 09:44 | Jacob Wieland - Spirent | Status | new => confirmed
09-06-2017 14:36 | KristÃ³f Szabados | Note Added: 0014698 |
09-06-2017 14:36 | KristÃ³f Szabados | Status | confirmed => resolved
09-06-2017 14:36 | KristÃ³f Szabados | Resolution | open => fixed
09-06-2017 14:36 | KristÃ³f Szabados | Assigned To | KristÃ³f Szabados => Gyorgy Rethy
07-09-2017 08:44 | Tomas Urban | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
30-12-2017 17:20 | Gyorgy Rethy | Note Added: 0014958 |
30-12-2017 17:20 | Gyorgy Rethy | Status | resolved => closed
30-12-2017 17:20 | Gyorgy Rethy | Product Version | => v4.9.1 (published 2017-05)
30-12-2017 17:20 | Gyorgy Rethy | Fixed in Version | => v4.10.1 (published 2018-05)
30-12-2017 17:20 | Gyorgy Rethy | Target Version | => v4.10.1 (published 2018-05)

Notes

(0014588)
szabados
19-04-2017 15:02

In Titan we allow declarations everywhere in the statement block.
Maybe the BNF could be modified like this:
168.StatementBlock ::= "{" [FunctionDefList] [FunctionStatementList] "}"
169.FunctionDefList ::= {(FunctionLocalDef | FunctionLocalInst) [WithStatement]
[SemiColon]}+
170.FunctionStatementList ::= {FunctionStatement [SemiColon]}+
171.FunctionLocalInst ::= VarInstance | TimerInstance
172.FunctionLocalDef ::= ConstDef | TemplateDef
173.FunctionStatement ::= ConfigurationStatements |
TimerStatements |
CommunicationStatements |
BasicStatements |
BehaviourStatements |
SetLocalVerdict |
SUTStatements |
TestcaseOperation
==>
StatementBlock ::= "{" [FunctionStatementOrDefList ] "}"
FunctionStatementOrDefList ::= {FunctionStatementOrDef [SemiColon] }+
FunctionStatementOrDef ::= FunctionLocalInst |
FunctionLocalDef |
FunctionStatement
FunctionLocalInst ::= (VarInstance | TimerInstance) [WithStatement]
FunctionLocalDef ::= ( ConstDef | TemplateDef ) [WithStatement]
FunctionStatement ::= ( ConfigurationStatements |
TimerStatements |
CommunicationStatements |
BasicStatements |
BehaviourStatements |
SetLocalVerdict |
SUTStatements |
TestcaseOperation )

(0014589)
Jacob Wieland - Spirent
19-04-2017 15:16

we also have had this feature in our tool in non-standard-compliant mode since the beginning, so, I guess, it really makes sense.

(0014625)
Jens Grabowski
06-06-2017 12:15

STF discussion: ok, check with Tomas

(0014638)
Tomas Urban
07-06-2017 09:12

We have the described feature in our tool as well. I will prepare a detailed draft so that we can discuss the details.

(0014655)
Tomas Urban
08-06-2017 15:56

Proposal draft uploaded. Please check.

(0014687)
Jacob Wieland - Spirent
09-06-2017 09:44

please review

(0014698)
KristÃ³f Szabados
09-06-2017 14:36

The resolution is ready to be added to the next version of the core language specification

(0014958)
Gyorgy Rethy
30-12-2017 17:20

Added to draft V4.9.2