I think we're mostly misinterpreting the OP's intent... He's not explicitly
claiming that the interfaces declared to be implemented are the only ones a
type can implement. Rather, the intent seems documentarian.
There are several solutions to this issue:
1. The convention in Go is to declare interface names based on method
names (or on the composition of methods). A brief familiarization with the
standard library interfaces will quickly allow you to identify the
interfaces any type implements -- for example, if a type has a ReadAt
method, you can generally assume it implements the io.ReaderAt interface
(and it would be bad behavior on the author of the type if it does not
conform to that interface).
2. Tooling (including your editor), as mentioned by Dmitri. Outside of
an editor, a specialized tool could be written to generate interface
3. Instead of inventing new syntax, conventional use of comments can
achieve the same, serving in part the same role that the api tool does.
On Tuesday, May 14, 2013 12:01:15 AM UTC-6, andrey mirtchovski wrote:
This has been discussed at least forever on the mailing list. The
consensus is that rather than forcing everyone to explicitly state
what they support, you can instead use the type system to verify it
for them at runtime and at no extra clacking cost:http://play.golang.org/p/VmI9264X9q
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.