ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details
0005084Part 01: TTCN-3 Core LanguageClarificationpublic16-04-2009 14:1215-07-2009 14:29
Gyorgy Rethy 
Ina Schieferdecker 
normalminorhave not tried
closedfixed 
 
v4.2.1 (published 2010-07)v4.2.1 (published 2010-07) 
5.2, D.4
     
0005084: Use of the __SCOPE__ macro
As currently defined, the __SCOPE__ TTCN-3 macro shall return the identifyer of the named scope unit it is used in. However, it raises the problem of using the macro in global templates. Global parameterized templates behave like scope units as formal parameter names are local names obeying to scoping rules. But parameterized templates are not defined as scope units today.

As a consequence it is not possible to get the template name with the __SCOPE__ macro. See the example below:
template myType t_MyTemplate (charstring p_char := __SCOPE__) { f1 := p_char,...}

The module name can be obtained by using __MODULE__, therefore it would be practical if __SCOPE__ returned the name of the template and not the module name.

Proposal: define (at least parameterized) templates as scope units and add templates to $D.4 as
"...basic scope units of TTCN-3 are module definitions part, module control part, component types, functions, altsteps, test cases, statement blocks and templates. ...
(g) a template name, if the lowest named scope is a template definition."
No tags attached.
related to 0005268closed Ina Schieferdecker Definition prepocessing macro: __DEFINITION__ 
doc CR5084_SCOPE_macro.doc (26,624) 22-04-2009 16:06
http://oldforge.etsi.org/mantis/file_download.php?file_id=2112&type=bug
doc CR5084_SCOPE_macro_v2.doc (247,296) 03-07-2009 15:07
http://oldforge.etsi.org/mantis/file_download.php?file_id=2162&type=bug
doc CR5084_SCOPE_macro_v3.doc (260,096) 06-07-2009 12:49
http://oldforge.etsi.org/mantis/file_download.php?file_id=2168&type=bug
ppt CR5084_SCOPE_macro_Figure.ppt (43,520) 08-07-2009 10:00
http://oldforge.etsi.org/mantis/file_download.php?file_id=2182&type=bug
? scope.ttcn3 (1,359) 08-07-2009 17:20
http://oldforge.etsi.org/mantis/file_download.php?file_id=2194&type=bug
? def.ttcn3 (1,371) 08-07-2009 17:21
http://oldforge.etsi.org/mantis/file_download.php?file_id=2195&type=bug
? scope_v2.ttcn3 (1,848) 10-07-2009 12:30
http://oldforge.etsi.org/mantis/file_download.php?file_id=2208&type=bug
doc CR5084_SCOPE_macro_v4.doc (295,936) 10-07-2009 12:36
http://oldforge.etsi.org/mantis/file_download.php?file_id=2209&type=bug
ppt CR5084_SCOPE_macro_Figure_v2.ppt (31,232) 10-07-2009 12:36
http://oldforge.etsi.org/mantis/file_download.php?file_id=2210&type=bug
doc CR5084_SCOPE_macro_v5.doc (298,496) 10-07-2009 14:44
http://oldforge.etsi.org/mantis/file_download.php?file_id=2212&type=bug
Issue History
16-04-2009 14:12Gyorgy RethyNew Issue
16-04-2009 14:12Gyorgy RethyClause Reference(s) => 5.2, D.4
16-04-2009 14:12Gyorgy RethySource (company - Author) =>
20-04-2009 11:29Ina SchieferdeckerNote Added: 0008511
20-04-2009 11:30Ina SchieferdeckerProjectTTCN-3 Change Requests => Part 01: TTCN-3 Core Language
20-04-2009 11:30Ina SchieferdeckerAssigned To => Tibor Csöndes
20-04-2009 11:30Ina SchieferdeckerStatusnew => assigned
20-04-2009 11:30Ina SchieferdeckerCategoryTTCN-3 Core Language => Clarification
20-04-2009 11:30Ina SchieferdeckerTarget Version => Edition 4.2.1 (not yet published)
22-04-2009 16:06Tibor CsöndesFile Added: CR5084_SCOPE_macro.doc
22-04-2009 16:09Tibor CsöndesNote Added: 0008543
03-07-2009 15:07Tibor CsöndesFile Added: CR5084_SCOPE_macro_v2.doc
03-07-2009 15:10Tibor CsöndesNote Added: 0008833
03-07-2009 15:10Tibor CsöndesAssigned ToTibor Csöndes => Gyorgy Rethy
06-07-2009 12:49Gyorgy RethyNote Added: 0008841
06-07-2009 12:49Gyorgy RethyFile Added: CR5084_SCOPE_macro_v3.doc
06-07-2009 12:49Gyorgy RethyAssigned ToGyorgy Rethy => Tibor Csöndes
08-07-2009 09:59Tibor CsöndesNote Added: 0008858
08-07-2009 10:00Tibor CsöndesFile Added: CR5084_SCOPE_macro_Figure.ppt
08-07-2009 13:20Tibor CsöndesFile Added: CR5084_SCOPE.ttcn
08-07-2009 13:22Tibor CsöndesNote Added: 0008868
08-07-2009 15:08Ina SchieferdeckerNote Added: 0008874
08-07-2009 15:08Ina SchieferdeckerFile Added: CR5084_scope.ttcn3
08-07-2009 16:46Ina SchieferdeckerFile Deleted: CR5084_scope.ttcn3
08-07-2009 16:48Ina SchieferdeckerFile Added: scope.ttcn3
08-07-2009 17:02Tibor CsöndesRelationship addedrelated to 0005268
08-07-2009 17:13Ina SchieferdeckerFile Deleted: scope.ttcn3
08-07-2009 17:20Tibor CsöndesFile Deleted: CR5084_SCOPE.ttcn
08-07-2009 17:20Tibor CsöndesFile Added: scope.ttcn3
08-07-2009 17:21Tibor CsöndesFile Added: def.ttcn3
08-07-2009 17:21Tibor CsöndesNote Added: 0008877
09-07-2009 09:33Ina SchieferdeckerNote Deleted: 0008868
09-07-2009 09:33Ina SchieferdeckerNote Deleted: 0008874
10-07-2009 12:30Tibor CsöndesNote Added: 0008888
10-07-2009 12:30Tibor CsöndesFile Added: scope_v2.ttcn3
10-07-2009 12:35Tibor CsöndesNote Edited: 0008888
10-07-2009 12:36Tibor CsöndesFile Added: CR5084_SCOPE_macro_v4.doc
10-07-2009 12:36Tibor CsöndesFile Added: CR5084_SCOPE_macro_Figure_v2.ppt
10-07-2009 12:39Tibor CsöndesAssigned ToTibor Csöndes => Gyorgy Rethy
10-07-2009 14:08Gyorgy RethyNote Added: 0008890
10-07-2009 14:09Gyorgy RethyFile Added: CR5084_SCOPE_macro_v5.doc
10-07-2009 14:09Gyorgy RethyAssigned ToGyorgy Rethy => Tibor Csöndes
10-07-2009 14:09Gyorgy RethyResolutionopen => fixed
10-07-2009 14:44Gyorgy RethyFile Deleted: CR5084_SCOPE_macro_v5.doc
10-07-2009 14:44Gyorgy RethyFile Added: CR5084_SCOPE_macro_v5.doc
10-07-2009 14:46Tibor CsöndesNote Added: 0008891
10-07-2009 14:46Tibor CsöndesAssigned ToTibor Csöndes => Ina Schieferdecker
10-07-2009 14:46Tibor CsöndesStatusassigned => resolved
15-07-2009 14:29Ina SchieferdeckerStatusresolved => closed
15-07-2009 14:29Ina SchieferdeckerFixed in Version => Edition 4.2.1 (not yet published)

Notes
(0008511)
Ina Schieferdecker   
20-04-2009 11:29   
One could also think about types as scope units. All potential scope units need to be checked.
(0008543)
Tibor Csöndes   
22-04-2009 16:09   
Changes uploaded based on the proposal.
Correct, standalone example:
template charstring t_MyTemplate (charstring p_char := __SCOPE__) := p_char;
(0008833)
Tibor Csöndes   
03-07-2009 15:10   
Version 2 uploaded. Templates and structured types included as a new scope unit. Figure, "Hierarchy of scope units" redraw, examples included into __SCOPE__ macro section.
(0008841)
Gyorgy Rethy   
06-07-2009 12:49   
I'm at figure 1. Thinking about what to draw below Templates and Types. Template fields may be of structured typed as well but are they scope units? For conssitency they should be (though at this moment I cannot see a practical consequence, except more clarity).
 
A structured type can be defined embedded within other structured types, this shall be drawn on the figure (just an embedded structured type below structured type, embedded structured type below embedded structured type, dashed line.

Textual description of templates and types as scope units is missing from above the figure.

See the rest in CR5084_SCOPE_macro_v3.doc.

I noticed that the figure cannot be edited if embedded this way. This may be a pro or a cons. If we find a good place to store it for next editions, it is a pro. If not, they should be embedded as Powerpoint objects.
(0008858)
Tibor Csöndes   
08-07-2009 09:59   
It is possible to edit the figure because this is an embedded .ppt object: right click on the object -> Presentation Object -> Edit. In addition I have uploaded the original PowerPoint slide.
(0008877)
Tibor Csöndes   
08-07-2009 17:21   
Uploaded scope.ttcn3 and def.ttcn3 are working examples for __SCOPE__ and __DEF__ macro.
(0008888)
Tibor Csöndes   
10-07-2009 12:30   
(edited on: 10-07-2009 12:35)
After our discussion the decision is the following:
- do not introduce __DEF__ macro only __SCOPE__
- we will use unqualified names (only "control" and not "modulename.control")
- new scope units: templates and user-defined types, i.e. basic types like integer, charstring are not scope units, but type restrictions of a basic type shall be a scope unit.

Based on our discussion new examples (scope_v2.ttcn3) created and uploaded.
New version (CR5084_SCOPE_macro_v4.doc) also uploaded.

(0008890)
Gyorgy Rethy   
10-07-2009 14:08   
CR5084_SCOPE_macro_v5.doc:
Note 2 of D.4 deleted, Example 2 is extended to show also a default value of a formal parameter, plus a few editorials. Otherwise OK with me.
(0008891)
Tibor Csöndes   
10-07-2009 14:46   
It's OK with me!