This page is no longer maintained — Please continue to the home page at www.scala-lang.org

A question of conversions and Manifests

2 replies
Brian Troutwine
Joined: 2011-06-06,
User offline. Last seen 42 years 45 weeks ago.

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?

mepcotterell
Joined: 2011-03-17,
User offline. Last seen 40 weeks 6 days ago.
Re: A question of conversions and Manifests

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
>

roland.kuhn
Joined: 2011-02-21,
User offline. Last seen 35 weeks 3 days ago.
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
>>
>
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland