class A
operations
op: () ==> ()
op() == skip;
thread
op();
end A
class B
operations
op: () ==> ()
op() == skip;
thread
op();
end B
class C
operations
op: A | B ==> ()
op(obj) == start(obj); -- Error 3237: Class does not define a thread
end C
Clearly the object does define a thread as each of the components of the union do. The problem is partly because thread definitions are currently "protected" by default, and partly because the simulated type created by the union only considers visible types. Because the start call is outside both A and B, the protected threads are not visible.
I think this ought to be legal (and it is used in one of the variants of the POP3 example!)
The following spec produces an error:
Clearly the object does define a thread as each of the components of the union do. The problem is partly because thread definitions are currently "protected" by default, and partly because the simulated type created by the union only considers visible types. Because the start call is outside both A and B, the protected threads are not visible.
I think this ought to be legal (and it is used in one of the variants of the POP3 example!)