Próbowałem skompilować kod z this SO question i uruchomić ten komunikat o błędzie cannot find class manifest for element type T
. Oto kolejny fragment, który pokazuje zachowanie:nie można znaleźć manifestu klasy dla elementu typu T
scala> def f[T](a:T, b:T):Array[T] = { new Array[T](2) }
<console>:4: error: cannot find class manifest for element type T
def f[T](a:T, b:T):Array[T] = { new Array[T](2) }
widzę, że new collection.mutable.GenericArray[T](2)
rozwiązuje ten problem. Podobno dostarczanie manifestu jest inną opcją ... Ale co oznacza "dostarczanie oczywistego środka"?
Należy pamiętać, że nazwa GenericArray została zmieniona na ArraySeq w wersji Scala 2.8. –