I think it's important to distinguish the use cases of defining new stores (somewhat rare) versus using the `store` method (very common). The strategy employed here is a common way to use generics to ensure type safety for the latter case. In the former case, there are all sorts of weird things one could do to defeat the type system, but spending a bit more effort to get it right so that the common case is safer and more pleasant is worth it, in my opinion.
Ismael On Thu, Jul 14, 2016 at 12:23 AM, Damian Guy <damian....@gmail.com> wrote: > Yes, you get compile time errors > > On Wed, 13 Jul 2016 at 16:22 Damian Guy <damian....@gmail.com> wrote: > > > You wont get a runtime error as you wouldn't find a store of that type. > > The API would return null > > > > On Wed, 13 Jul 2016 at 16:22 Jay Kreps <j...@confluent.io> wrote: > > > >> But if "my-store" is not of type MyStoreType don't you still get a run > >> time > >> error that in effect is the same as the class cast would be? Basically > the > >> question I'm asking is whether this added complexity is actually moving > >> runtime errors to compile time errors. > >> > >> -Jay > >> >