Go's structural typing system for interfaces creates implementation challenges despite its conceptual simplicity. The inability to add default methods to interfaces without breaking existing code leads to messy APIs like flag.Value. A workaround using struct embedding with unexported methods can simulate default implementations
Table of contents
flag.Value is a MessStruct EmbeddingsUsing DefaultsShouldn’t This Be a Language Feature?Conclusion1 Comment
Sort: