What are the limitations of Scala's Manifests?
Asked Answered
E

2

7

Scala's Manifests are a way to get around some type erasure problems due to the JVM's lack of reified generics.

They are discussed in several other questions; here are a few:

One of the comments mentions that “This feature is experimental, and there are cases in which it doesn't work. Still, it can go a long way.” (Daniel Sobral)

What are the cases where the Manifest approach breaks down and why?

Encephalitis answered 16/4, 2011 at 6:25 Comment(0)
W
8

The most important case should be open Tickets in the Scala teams bug tracking system. I found the following:

I believe the general idea is, that Manifests will be part of the planned/upcomming Scala reflection library and apart from using them in the context of Arrays is "on your own risk" ( see ).

Wingate answered 16/4, 2011 at 9:50 Comment(0)
F
3

One more:

    scala> class C;
    defined class C

    scala> trait T;
    defined trait T

    scala> manifest[C] <:< manifest[C with T]
    res0: Boolean = true

I've not even reported it since, according to this, manifests are deprecated in 2.10 so they are not fixing bugs with them.

Fideicommissum answered 17/10, 2012 at 6:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.