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

TOPIC:

Fun with encoding attributes 21 May 2002 11:01 #6139

Hi!

When thinking a little bit more about encoding attributes, Thomas Deiss and I have come up with a number of questions ragrding those.

Consider the following example:

module M {

type record R1 {
integer field1
} with { encode override "E1" }

type record R2 {
integer field1
} with { encode override "E2" }

type port PT message {
inout integer;
}

type component CT {
port PT P
}

const integer c0 := 1;
const R1 c1 := { 1 };
const R2 c2 := { 1 };

testcase tc() runs on CT {

P.send(c0);
P.send(c1.field1);
P.send(c2.field1);

}
} with { encode "E0" }

The question is, what encoding attributes are used when sending the three integer values in tc().

There are (at least) the following two alternatives:

a) all three values are sent with encoding "E0". For the first, this is clear anyway, for the second and third send stmt, E0 is chosen because after all what is sent are pure integers (not within the context of a record of type R1 and R2), hence the attribute "E0" applies.

b) c0 is sent using "E0", c1.field1 using "E1", and c2.field1 using "E2". Because the latter two integer values are field of record types that specifiy encoding attributes also for their fields, and hence the corresponding encoding attribute applies.

Personally, we would prefer a) because is seems to be the more comprehensible approach and would be robust also, e.g., when c1.field is first assigned to a varibale x of type integer and then sent.

Opinions?

More complicated example with separate issues will follow in a separate mail.

Best regards

Stephan Tobies

Please Log in to join the conversation.

  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin