Hi All,
Many thanks again for all your comments and explanations. They were very helpful.
Regards
Ray
________________________________
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 Claude Desroches
Sent: 31 May 2006 11:42
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Template Field Ordering
Hi,
Ordering of fields in a record is fixed.
Ordering of fields in a set is not fixed.
This is a result of a similar behavior found in ASN.1 SET, which TTCN-3 has adopted.
Although, ordering of fields in a set is not fixed, it is not recommended, for readability
purposes and maintainablity and risk of needless errors to change the order of fields within
a template. It should not break anything if this is not respected, it just makes life easier
for whomever to compare types with templates.
Cheers,
Claude.
Ursprüngliche Mitteilung
Von: Cheung Ray-RCHEUNG1 <This email address is being protected from spambots. You need JavaScript enabled to view it.>
An: This email address is being protected from spambots. You need JavaScript enabled to view it.
Verschickt: Mi, 31 Mai 2006 10:43:07 +0100
Thema: Re: Template Field Ordering
Hi Alexey & Jörgen,
Many thanks for all your comments. Much appreciated.
I quite agree with you about arbitrary ordering. I'd rather it be disallowed in record types. I happened to be writing a tool when I came across this. It meant extra complication (though not a big deal) if I have to cater for this. May be I should have given you the full reason for my enquiry at the beginning. I was trying not to colour people's response. Probably a bad move on my part :).
Thanks Again
Ray
________________________________
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: 31 May 2006 10:23
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Template Field Ordering
Ray,
Other tools may complain about incorrect ordering of fields in the
template definition of record type in your example that has arbitrary
ordering of fields, so this is possibly not the best thing to do for code
portability reasons.
The standard does not allow arbitrary ordering of this kind for records,
but it does not prohibit it either, to my memory. So this is sort of a gray
area.
I totally agree on the best practice thing. This could be the reason why
other tools may enforce a stricter policy requiring same (non-arbitrary)
field ordering for type and value notation when records are involved on
semantic level.
Think of a record type with 30 fields or more (not uncommon in industrial
test suites) and test suite readability issues that come up if fields in the test
suite are organized in arbitrary order, especially in cases when ordering is
implied (that is, record).
Alexey Mednonogov
OpenTTCN Oy
Original Message ----
From: Cheung Ray-RCHEUNG1 <This email address is being protected from spambots. You need JavaScript enabled to view it.>
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Sent: Wednesday, May 31, 2006 12:02:36 PM
Subject: Re: Template Field Ordering
Thanks. This was not actually about best practice - I should've explained. It's just that I was surprised to see that Telelogic TAU G2 Tester didn't complain when a similar template definition as one described below was made. I just wanted to know for sure if this is the correct behaviour or not. Can anyone please confirm/deny?
Regards
Ray
________________________________
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 Jörgen Svensson R (KA/EAB)
Sent: 31 May 2006 09:48
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Template Field Ordering
You should probably use
type set tMyRec
{
integer a,
charstring b
}
Regards
/Jörgen Svensson
Karlskrona, Sweden
________________________________
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 Cheung Ray-RCHEUNG1
Sent: den 31 maj 2006 10:35
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Template Field Ordering
Hi,
I think I remember reading somewhere in the language spec that, in template definitions, the ordering of record fields can be arbitrary. I've been struggling to find where this is stated in the language spec, can anyone confirm or deny whether this is just a figment of my imagination please?
E.g.:
type record tMyRec
{
integer a,
charstring b
};
// field order wrong way round, but OK?
template tMyRec tpMyRec :=
{
b := 'Hi World!",
a := 1
};
Thanks
Ray Cheung
Motorola, Swindon, UK