Staffan,
Think of it that way:
Correct, TTCN-3 standard does not tell it explicitly what should
happen in this case, nor it defines any complex rules for derivation
from omit, *, ?, complement etc. etc. defined as values of nested
record fields (as in your example).
Trying to read between lines in the standard, an assumption can be
made that all such matching mechanisms shall be treated as indivisible
values from the point of view of derivation, i.e. such values can be
modified only as a whole altogether. I am therefore aware of at least
one tool where you can't write templateC like in your modified example
(hoping to get { a := 3, b := ? }), and you can't do that for a good
reason (being able to do so would probably require introduction of
complex, hard-to-memorize and hard-to-keep-consistent rules).
Counter example why such derivation is tricky:
type record REC1
{
integer a,
integer b optional
}
template SIGNAL1 templateB :=
{
rec1:= ?
}
This is then equivalent to writing:
template SIGNAL1 templateB_equiv :=
{
rec1 :=
{
a := ?,
b := *
}
}
Now if we derive templateC from templateB in the way as you proposed,
would we then get { a := 3, b := ? } or { a := 3, b := * }? And if so,
is it intuitively appealing? Note that this is only one example that
came to my mind immediately, and if we examine the problem more broadly
(taking into account all possible combinations of *, ?, omit, other
matching mechanisms etc.), this could get unmanageable.
To sum up, I agree that this is a grey area in the standard. For example
Johan has correctly referenced clause 14.6.0, however in my opinion this
reference would have had more value if the standard had specified somewhere
explicitly that rec1 := ? is equivalent to rec1 := { a := ?, b := ? } and
if it had introduced similar well-defined equivalence rules for all matching
mechanisms concerning records.
Hope this helps,
Alexey Mednonogov
Software Engineer
OpenTTCN Oy
www.openttcn.com/
Staffan Grundberg (LI/EAB) wrote:
>Hi,
>
>maybe you already answered my question but here is what i really meant:
>
>type record SIGNAL1
>{
> REC1 rec1
>}
>
>type record REC1
>{
> integer a,
> integer b
>}
>
>template SIGNAL1 templateB :=
>{
> rec1:= ?
>}
>
>template SIGNAL1 templateC modifies templateB :=
>{
> rec1 :=
> {
> a := 3
> }
>}
>
>Will templateC have these values for a and b
> a := 3,
> b := ?
>
>Thanks again.
>
>Staffan Grundberg
>
>
>
Original Message
>From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[
This email address is being protected from spambots. You need JavaScript enabled to view it.]On Behalf Of Alexey Mednonogov
>Sent: den 11 maj 2004 17:33
>To:
This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: Simple TTCN-3 standard questions
>
>
>Hi Staffan,
>
>Did you actually mean that templateB modifies templateA and
>templateC modifies templateC? Then you should have written
>something like:
>
>template SIGNAL1 templateB modifies templateA := { ... };
>template SIGNAL1 templateC modifies templateB := { ... };
>
>Assuming that this was what you actually meant:
>
>In templateB you modify the whole value of rec1 altogether,
>so its new value in templateB is now '?', previous value in
>templateA has now no significance for templateB.
>
>If you derive templateC from templateB, then you modify
>exactly this '?' value (matching mechanism) defined in
>templateB, not anything previously defined in templateA.
>
>Therefore, correct value notation for templateC in strict
>compliance with the TTCN-3 standard shall be as follows:
>
>template SIGNAL1 templateC modifies templateB :=
>{
> rec1 :=
> {
> a := 3,
> b := omit
> }
>};
>
>You might have probably thought that the resulting value of rec1
>in templateC in your example would have been {a := 3, b := 3}, but
>that would have been the case if you derived templateC directly
>from templateA.
>
>Concerning you question whether derivation from a question mark (?)
>value is allowed: I do not recollect any clause in the standard that
>explicitly prohibits this, so that means that this shall be allowed.
>
>Hope this helps,
>Alexey Mednonogov
>
>Software Engineer
>OpenTTCN Oy
>
www.openttcn.com/
>
>Staffan Grundberg (LI/EAB) wrote:
>
>Hi,
>
>I have two question regarding the TTCN-3 standard.
>
>If I have a nested structured template. i.e.:
>
>template SIGNAL1 templateA
>{
> rec1:=
> {
> a:=32,
> b:=3
> }
>}
>
>
>and i define another template:
>
>template SIGNAL1 templateB
>{
> rec1:= ?
>}
>
>can i then use this:
>
>template SIGNAL1 templateC
>{
> rec1 :=
> {
> a := 3
> }
>}
>
>That is do the TTCN-3 standard specify if the situation, where a modified
template specifies fields in an record that was only defined as "?" in the
parent template, is allowed?
>
>The second question is:
>Can or will TTCN-3 support a matching mechanism that can match a array (record)
to any permutation of say {1, 2, 3}
>
>
>Thanks in advance
>Staffan Grundberg
>
>