Infer Abstract class type from constructor


#1

Would shorter syntax for Abstract inheritance be feasible?

abstract class Abstract<T>(val param: T)

class Test : Abstract("string")           
class Test : Abstract<>("string")

Thanks,
Fabian


#2

There are at least two reasons why we don’t have this:

  • the compiler and tooling really want to know the supertypes (with type-arguments) without having to look into expressions ("string"),
  • in cases more complex than this one the users prefer having the same information.

While the second point is somewhat a matter of taste, the first one is rather important for smooth tooling.