Hi Thomas,
unfortunately this case is not covered 'completely' covered in the
section of
type compatability.
I wrote completely, because your example:
>
> function g(inout Q1 q) {
> connect(q:p1, mtc:p1);
> return
> }
>
> testcase tcb () runs on Q1 {
> var Q1 q1;
> var Q2 q2;
> q1 := Q1.create;
> q2 := Q2.create;
> g(q1);
> g(q2);
> }
>
would be definitely incorrect, if you modify function g a little bit to
e.g.,
function g(inout Q1 q) {
connect(q:p1, mtc:p1);
p1.send(q); // the component sends the reference to another component
return
}
The send operation requires strong typing for q according to 6.7.3.
Back to your questions:
> Clearly, the call 'g(q1)' is type correct. But what about the second call
'g(q2)'?
> I think this should be type correct. First, the situation is quite similar to
runs on clauses.
> Second, any operation possible on components of type Q1 is possible on
components of type Q2.
>
> Any opinions out there?
>
According to my interpretation g(q2) is not correct. However, the case
you detected looks
like an inconsistency in the standard. Some type compatability rules
related to the
'runs on clause' are not in the type compatability section 6.7. And, in
addition, your
points should also be explained.
If you have time to work on a proposal for completion/correction of
Section 6.7 or if Nokia
wants to have additional/new compatability rules for component
references, please use
the TTCN-3 Change Request procedure. Any help to improve the standard is
welcome!
Regards
Jens
Thomas Dei_ schrieb:
>
> Hello all,
>
> I have a question regarding type compatibility of component (references).
>
> The standard (V2.2.0) states clearly in Section 16.3 that a function can run
on an instance of a component with further ports, variables, and timers than the
one it was defined for.
>
> Given the definitions
>
> type port P message {inout all};
>
> type component Q1 {port P p1};
> type component Q2 {port P p1, p2};
>
> function f() runs on Q1 {return};
>
> then the following testcase is correct. Note that the function f is started on
a component of type Q2 instead of Q1.
>
> testcase tca () runs on Q1 {
> var Q2 q2;
> q2 := Q2.create;
> q2.start(f());
> }
>
> Up to this point the situation is clear. What is unclear is whether it is
possible to pass a component reference of type Q2 as actual parameter to a
function expecting a parameter of type Q1.
>
> function g(inout Q1 q) {
> connect(q:p1, mtc:p1);
> return
> }
>
> testcase tcb () runs on Q1 {
> var Q1 q1;
> var Q2 q2;
> q1 := Q1.create;
> q2 := Q2.create;
> g(q1);
> g(q2);
> }
>
> Clearly, the call 'g(q1)' is type correct. But what about the second call
'g(q2)'? I think this should be type correct. First, the situation is quite
similar to runs on clauses. Second, any operation possible on components of type
Q1 is possible on components of type Q2.
>
> Any opinions out there?
>
> Best regards
>
> Thomas
>
>
> | Thomas Deiß, Nokia Research Center Street address: |
> | P.O. Box 101823 Meesmannstraße 103 |
> | D-44718 Bochum, GERMANY D-44807 Bochum, GERMANY |
> | Phone: +49 234 984 2217 (int. 8272217) |
> | Fax: +49 234 984 3491 (int. 8273491) |
> | E-mail:
This email address is being protected from spambots. You need JavaScript enabled to view it. |
>
--
======================================================================
Dr. Jens Grabowski
Institute for Telematics phone: +49 451 500 3723
University of Luebeck fax: +49 451 500 3722
Ratzeburger Allee 160 eMail:
This email address is being protected from spambots. You need JavaScript enabled to view it.
D-23538 Luebeck or
This email address is being protected from spambots. You need JavaScript enabled to view it.
(Germany) WWW:
www.itm.mu-luebeck.de
======================================================================