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

TOPIC: Type ambiguity and Encoding

Type ambiguity and Encoding 22 Oct 2001 10:33 #6005

Hi!

Image that we have two "overlapping" sub types of the same type with
different encodings:

type integer myInt1 (1..10) with { encoding "MyEncoding1" };
type integer myInt2 (2..20) with { encoding "MyEncoding2" };

Further imagine that there is a port type that can send messages of these
two types:

type port MyPort message {
inout myInt1,myInt2 ;
}

If P is a port of type MyPort, is the statement

P.send(5);

legal TTCN-3?

Note, that it cannot be determined from the context whether 5 is of type
myInt1 or myInt2 and so it is not clear which encoding is to be used. There
is a clause in the standard that requires an explicit type in situations
like this if it occurs in the context of a receive statement, but I don't
think that the standard says anything about the case of a send statement.

In general, how much effort should a compiler put into type inference?
Clearly, if MyPort could only send messages of type myInt1, it would be
clear that the 5 here is a myInt1 and the compiler could figure out the
right encoding. But should the compiler do this kind of type inference or
should the above statement still be considered as an error that needs to be
resolved by the TTCN-3 programmer? I think that the issues of type checking
and type inference needs more consideration.

Best regards

Olle



Telelogic Tau 4.2 speeds up your wireless development!
Read more about it at www.telelogic.com/tau42

Olle Palmgren
Director of Engineering, PD Test
Telelogic, St Persgatan 13, SE-753 20, Uppsala, Sweden
Phone: +46 18 66 18 59
Fax: +46 18 66 18 70
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.telelogic.com

Telelogic - Putting you ahead in software development!

The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin