HaloO, John M. Dlugosz wrote:
Interesting idea, but that doesn't tell the compiler that the return is keyed to the context. The compiler should know what return type to expect, if only I could explain it.How about sub foo (--> Seq^Item) {...}?
Sorry, the type has nothing to do with how the function comes up with its return value. In that respect you must regard the context as part of the input of the function that of course influences its output.
I don't see how Seq^Item as a type is any different than Seq|Item. It can only hold one at a time anyway.
A type is a type. There is nothing that varies or holds a value or some such. Seq|Item means to me that there are three cases: Seq only, Item only and both. Seq^Item excludes the latter. That is Seq^Item is the disjoint union of Seq and Item. Larry's reply essentially means Item <: Seq that is Seq subsumes Item. But that has problems of its own---see my reply there. Regards, TSa. -- "The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
