Replies: 1 comment
-
This is a really good suggestion. I realize that some implementations of I could pull a definition of that up to the interface too. Then there are quite a few implementations to work through, but that could be done over a longer period of time because we could keep the old overload for existing implementations too. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This proposal suggests modifying the
AddFile
method signature in theDiscUtils
project to accept aFunc<Stream>
instead of a directStream
. This change aims to optimize resource management and the method's flexibility, especially in scenarios where theBuild
method finalizes data writing.Detail
Currently, the
AddFile
method accepts aStream
parameter directly, implying that the data stream must be available and open at the call time, regardless of when the writing actually occurs (via theBuild
method). This approach can lead to resource management issues, such as streams being prematurely closed or locked due to their use in other processes before the execution ofBuild
.The proposal is to change the
AddFile
method signature to accept aFunc<Stream>
. This would allow:Stream
until just before its use, ensuring its availability and optimal condition.Stream
lifecycle, aligning with reactive and functional programming principles.Previous Usage Example
Proposed Usage Example
Advantages
I appreciate your consideration of this proposal and are open to discussing any related aspects. I believe this improvement can significantly add value to
DiscUtils
project.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions