Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Template Field Ordering

Template Field Ordering 31 May 2006 08:35 #6921

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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 08:47 #6922

  • J
  • J's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 09:02 #6923

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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 09:23 #6924

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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 09:30 #6925

  • J
  • J's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
You're welcome!

If you use the 'type set <recname>' you can put the parameters in any order when assigning values to a record.

type set tMyRec
{
integer a,
charstring b,
charstring c,
integer d
};

then

template tMyRec tpMyRec :=
{
b := 'Hi World!",
a := 1,
d::= 9,
c:= "abcdf"
};

will be exactly the same as

template tMyRec tpMyRec :=
{
d::= 9,
b := 'Hi World!",
c:= "abcdf",
a := 1
};


However, according to the TTCN3 Core Language (ETSI ES 201 873-1 V3.1.1 (2005-06), chapter 6.3.2) the elements of a set shall be referenced by dot notation.
So instead of writing a value list as examples above, the following notation should be used

tpMyRec.d := 9;
tpMyRec.b := "Hi World!";
tpMyRec.a := 1;
tpMyRec.c := "abcdf";

I have actually not used the dot notation myself (until now), so I reckon it depends on how strict the deliverer of TTCN environment reads the standard. :)
I think I will have to start using the dot notation, so I can remain TTCN3 compliant... ;)

If you print the type set template though, I think it will print the parameters in the order they are defined in the type definition.

Take care!
/Jörgen

________________________________

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 11:03
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 09:35 #6926

  • J
  • J's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
OK, sorry, I misunderstood the question.

I hope I didn't annoy anyone.

The order of parameters in a type record is not negotiable.. ,)

/Jörgen Svensson
Ericsson AB, 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 Alexey Mednonogov
Sent: den 31 maj 2006 11: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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 09:43 #6927

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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 10:42 #6928

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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 10:42 #6929

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
The administrator has disabled public write access.

Template Field Ordering 31 May 2006 16:12 #6930

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
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin