Re:Sum Types in Go
by jerf on Friday December 26, 2014 @10:27AM
(#8799032)
"Instead of using interfaces for simple "tagging", have them does something useful to all the types in the system,"
I said that already:
"Of course, the tag interface is only used if you have no meaningful interface to define for your sum type. If you do have a real interface you can define you don't need a fake is* function, just define the interface."
The point is precisely that this is still useful even if you've got nothing else in common with the types.
In the spirit of Go simplicity (cough), I actually prefer that the central pump define all the processing in one place when using a message pump, rather than scatter them around OO-style.
I said that already:
"Of course, the tag interface is only used if you have no meaningful interface to define for your sum type. If you do have a real interface you can define you don't need a fake is* function, just define the interface."
The point is precisely that this is still useful even if you've got nothing else in common with the types.
In the spirit of Go simplicity (cough), I actually prefer that the central pump define all the processing in one place when using a message pump, rather than scatter them around OO-style.