Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource releasing policy #319

Open
waagnermann opened this issue Aug 9, 2024 · 3 comments
Open

Resource releasing policy #319

waagnermann opened this issue Aug 9, 2024 · 3 comments

Comments

@waagnermann
Copy link

waagnermann commented Aug 9, 2024

Hi!
Am I right that you close resource only if it is a file?
otherwise (example) you let resource management to users?

@tototoshi
Copy link
Owner

Hi @waagnermann .
I believe that the responsibility for closing a resource lies with the person who created it. In this case, the FileInputStream is created internally by scala-csv, so it is scala-csv's responsibility to close it. However, Source or Reader is created by the user of scala-csv, and therefore, the user is responsible for closing it.

@waagnermann
Copy link
Author

waagnermann commented Aug 9, 2024

you are right about that.
but if a person chooses not to close his resource in order to use it later, another resource, that your library creates here will keep not being closed. is that right?

if so, it enforces the user to remember about this internal resource and close initial resource by means of this method, not the initial resource's .close() method

p.s. cause lineReader created by scala-csv same way as the FileInputStream you mentioned above

@tototoshi
Copy link
Owner

@waagnermann
I'm not entirely sure if I fully understand what you're saying, but maybe you are right and I realized that the current code lacks consistency.

I plan to fix this. Could you review the PR once I create it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants