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

Deprecate IO subs that operate on multiple paths in 6.e #5485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ugexe
Copy link
Member

@ugexe ugexe commented Dec 3, 2023

While convienient, being able to pass multiple paths to e.g. &rmdir is problematic because there isn't a blessed way to handle what to do when an exception or failure occurs, i.e. should it try to rmdir every entry even if some things fail, or stop on the first failure?

Previously rmdir("doesn't exist", "also doesn't exist") would return an empty array with no indication of what the failure was. Yet `("doesn't exist", "also doesn't exist").grep(*.IO.rmdir) does get failures for these. This difference in behavior is not intuitive.

This changes subroutines that act on multiple paths by adding a single path variant, as well as deprecating the multi file variant. The inclusion of a single path variant is a breaking change, as these subroutines will now return a failure instead of an array.

@ugexe
Copy link
Member Author

ugexe commented Dec 3, 2023

This requires some general consensus

ugexe added a commit to Raku/roast that referenced this pull request Dec 3, 2023
This changes various cleanup code to operate on a single file at
a time instead of using the multi-path subroutines.

see: rakudo/rakudo#5485
@ugexe ugexe force-pushed the ugexe/deprecate-multi-file-operations branch 2 times, most recently from 4c0a46b to 95bdb71 Compare December 3, 2023 01:31
@vrurg
Copy link
Member

vrurg commented Dec 3, 2023

Can we make it 6.e only? I generally concur, but best if we don't touch 6.c/d.

@ugexe ugexe force-pushed the ugexe/deprecate-multi-file-operations branch from 95bdb71 to 74f01d0 Compare December 3, 2023 21:01
@ugexe ugexe changed the title Deprecate IO subs that operate on multiple paths Deprecate IO subs that operate on multiple paths in 6.e Dec 3, 2023
@ugexe ugexe force-pushed the ugexe/deprecate-multi-file-operations branch from 74f01d0 to 5951684 Compare December 3, 2023 21:03
@ugexe
Copy link
Member Author

ugexe commented Dec 3, 2023

I've made the changes apply to 6.e. How do I adjust the spectests (t/spec/S16-filehandles/chmod.t and t/spec/S16-filehandles/mode.t)? Those two tests check that e.g. chmod @arr returns a list containing files.

@vrurg
Copy link
Member

vrurg commented Dec 3, 2023

I think @lizmat can explain better as I wasn't closely following the recent changes to the roast, but the first rule: have tests for each version with explicit use v6.x statement. Normally their names would end with -6x.rakutest. Then it looks like 6.c- and 6.d-specific tests are going under respective subdirectories of the roast.

@ugexe ugexe force-pushed the ugexe/deprecate-multi-file-operations branch from 5951684 to 4ceca13 Compare December 3, 2023 21:26
While convienient, being able to pass multiple paths to e.g. &rmdir
is problematic because there isn't a blessed way to handle what to
do when an exception or failure occurs, i.e. should it try to rmdir
every entry even if some things fail, or stop on the first failure?

Previously `rmdir("doesn't exist", "also doesn't exist")` would
return an empty array with no indication of what the failure was.
Yet `("doesn't exist", "also doesn't exist").grep(*.IO.rmdir)
does get failures for these. This difference in behavior is not
intuitive.

This changes subroutines that act on multiple paths by adding a
single path variant, as well as deprecating the multi file variant.
The inclusion of a single path variant is a breaking change, as
these subroutines will now return a failure instead of an array.
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

Successfully merging this pull request may close these issues.

None yet

2 participants