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
In #12 I suggested to add a separate sub package called unix with an API similar to the unix coreutils commands. This issue was closed with the suggestion to implement this in it's own package/library, separated from this package.
So I tried to figure out, what would be the best way to do this and therefore I wanted to reach out to you (@bitfield and all other followers of this package) to discuss, how this could be done.
My goal is to leverage this package, especially the Pipe and be able to combine (in an as nice as possible way) functions from this package (e.g. script.Freq()) with functions from an other package (e.g. unix.Head()).
I looked at the example in the README but this does not work in a seperate package, because you can not add new methods to an type defined in an other package.
So the question is, what is the best way to approach this?
The text was updated successfully, but these errors were encountered:
I've spotted this problem as well, and it's a shame, because I would have liked people to be able to implement their own Pipe methods in their own programs and libraries. I did consider making Pipe an interface, but of course it would be a gigantic and ever-growing interface, and you'd have to implement all of it just to add one method.
I think the only thing you can really do is build a unix.Pipe type which wraps the methods of script.Pipe—that gives you the opportunity to add new semantics. For example, unix.Pipe.Head() can work like Unix head, but perhaps call script.First() internally to implement it.
If you prefer to fork script entirely and give it a new API, I'm fine with that too, although that would obviously involve a lot of duplication, which isn't ideal.
In #12 I suggested to add a separate sub package called
unix
with an API similar to the unix coreutils commands. This issue was closed with the suggestion to implement this in it's own package/library, separated from this package.So I tried to figure out, what would be the best way to do this and therefore I wanted to reach out to you (@bitfield and all other followers of this package) to discuss, how this could be done.
My goal is to leverage this package, especially the
Pipe
and be able to combine (in an as nice as possible way) functions from this package (e.g.script.Freq()
) with functions from an other package (e.g.unix.Head()
).I looked at the example in the README but this does not work in a seperate package, because you can not add new methods to an type defined in an other package.
So the question is, what is the best way to approach this?
The text was updated successfully, but these errors were encountered: