Is there a reason why we can't pass a type as para...
# announcements
c
Is there a reason why we can't pass a type as parameter directly, and instead have to use the
::
notation?
fun foo(a: KClass) = ...
Copy code
foo(String) // Illegal
foo(String::class) // Legal
I know about reifed types that allow a simpler syntax, but my question is more about why it was made this way
It looks more Java-like this way, but apparently Scala did it the other way. I guess it's because it removes some ambiguity somewhere, but I don't see in which case it's a problem...
s
Because
String
would refer to its companion object (if it had one 😀)
👍 1
c
Oh. Yeah that was more obvious than I expected XD