- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
A question of conversions and Manifests
Mon, 2011-06-06, 18:19
Hello, all.
If Manifest[T] >:> Manifest[S] and there exists some val a:S is always
the case that (a:T) will succeed? How about a.asInstanceOf[T]? If the
first is not true, would it be appropriate and possible to define a
>%> on Manifest such that if Manifest[T] >%> Manifest[S] then (a:T)
always succeeds?
Sat, 2011-06-11, 00:07
#2
Re: A question of conversions and Manifests
I think he wants to know whether the runtime type checks offered by Manifest[T] are equivalent[*] to the static checks done by the compiler. Incidentally, I was the one to offer the assumption—in a different context—that <:< is just an approximation to the “real” type check. Although not urgently at this moment, I would also be interested in an answer.
[*] excluding implicits, of course
My assumption was based on a) a vague memory of such a statement in the scaladoc and b) my intuition that something rather clever must be done to transform the Turing-complete type language into something which can efficiently be checked at runtime—or is it the case that computing <:< may not terminate?
Regards,
Roland
On Jun 10, 2011, at 01:57 , Michael Cotterell wrote:
> What exactly are you trying to do?
>
> On Mon, Jun 6, 2011 at 1:19 PM, Brian Troutwine wrote:
>> Hello, all.
>>
>> If Manifest[T] >:> Manifest[S] and there exists some val a:S is always
>> the case that (a:T) will succeed? How about a.asInstanceOf[T]? If the
>> first is not true, would it be appropriate and possible to define a
>>> %> on Manifest such that if Manifest[T] >%> Manifest[S] then (a:T)
>> always succeeds?
>>
>> --
>> Brian L. Troutwine
>>
>
>
>
What exactly are you trying to do?
On Mon, Jun 6, 2011 at 1:19 PM, Brian Troutwine wrote:
> Hello, all.
>
> If Manifest[T] >:> Manifest[S] and there exists some val a:S is always
> the case that (a:T) will succeed? How about a.asInstanceOf[T]? If the
> first is not true, would it be appropriate and possible to define a
>>%> on Manifest such that if Manifest[T] >%> Manifest[S] then (a:T)
> always succeeds?
>
> --
> Brian L. Troutwine
>