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
{{ message }}
Repository navigation
Is it worthwhile to separate Diffable and Writeable? #8
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.
Activity
mvdan commentedon Jul 9, 2018
Here's another proposal - make
Writeablehalf of what it is. That is:Then the issue is that helpers like
Stringswould either start returning aDiffableonly, orDiffable, Writeable, Writeable.Still, this option B would remove the need for
DiffWriteable, and it would make funcs likeWriteUnifieda bit more modular.josharian commentedon Aug 28, 2019
This interacts with #4, which would get rid of the
Filenamepart ofWriteable. 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
AtAandAtBmethod to get individual elements, and then just pass whatever those return intofmt.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.Any other ideas?
rework writing API
josharian commentedon Aug 30, 2019
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.