Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do you have an example of how to make this work with an interface?


The author conveniently leaves out the implementation of the actual method calls themselves, which is frankly the important part.

  interface Query {
     All ...
     Insert ...
     Update ...
     Delete ...
     WhateverElse ...
  }
Now admittedly, the implementation is probably cleaner with "generics", but you can generically approach the problem with interfaces.


But how do you get the thing that implements that interface?

Either the framework has to know how to create a querier for each specific type, drop to using empty interfaces, or use generics.


The point of the interface is that the person authoring the code defines the internals.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: