You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's another proposal - make Writeable half of what it is.
This interacts with #4, which would get rid of the Filename part of Writeable. At which point it is a single method, so it could be a func param. I can't say that this feels like it fixes any problems, though.
Another option would be give Diffable an AtA and AtB method to get individual elements, and then just pass whatever those return into fmt.Fprint. This has an appeal, but it doesn't play nicely with diffing and writing slices of byte slices, since by default, byte slices print as a slice of integral values. We could work around that by special-casing byte slices, but that's ugly.
I just pushed some commits that make this a bit cleaner. I still agree it'd be nice to do something cleaner here; writing is a bit of a fly in the ointment. So I'll leave this open a bit for further discussion. But I'm out of ideas at the moment.
As I was reading the
TODO: better name
onDiffWriteable
, I thought to myself - is there a good reason to separate the interfaces?Unifying them would fix the naming issue, and make the simple use of the API simpler.
On the other hand, there's something I don't like about a "diffable" interface concerning
io.Writer
.The text was updated successfully, but these errors were encountered: