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
Should IO::Path be a value type? (i.e. eqv
-comparable)
#4515
Comments
From @dakkarThis:: '/tmp'.IO eqv '/tmp'.IO returns ``False``. Is this correct? Should IO behave like value objects? Possible problems: - two IO referring to non-existent paths: should they compare like -- Every journalist has a novel in him, which is an excellent place for it. |
From @lizmat
If they should work as value objects, they should probably compare .abspath. Liz |
The RT System itself - Status changed from 'new' to 'open' |
From @bdwI kind of think that's impossibly complex. What does it even mean for IO Bart 2015-09-05 16:14 GMT+02:00 Elizabeth Mattijsen <liz@dijkmat.nl>:
|
From @lizmatNote that we’re talking really about IO::Path objects here, which is what .IO generates. And in that context, I think an object $a with a given abspath, would be eqv to $b with the same abspath. Because that *is* the identifier on a file system, is it not? Liz
|
From @smlsIn current Rakudo, the original example prints True now: ➜ say "/tmp".IO eqv "/tmp".IO; However, it seems to use .Str rather than .abspath to compare them, so IO::Path objects that refer to the same path but constructed from different strings, are not considered the same: ➜ chdir "/tmp"; say "foo".IO eqv "/tmp/foo".IO; ➜ say "a/b".IO eqv "a/b/c/..".IO; ➜ ~ 6 'say "a".IO eqv "./a".IO' |
From @zoffixznet
The current behaviour is what we want to keep (this also now being far on the other side
Currently, we go through the default Mu `eqv` and so it compares *all* of IO::Path's attributes. All the other proposals in the ticket talk about different ways of verifying the two IO::Path objects - .abspath (now .absolute) doesn't access the filesystem, so two paths with different .abspaths can While the same issue exists with methods such as IO::Path.e, I think eqv comparison should go further than So in summation, I think the current behaviour of treating IO::Path as any other object, as we've been doing |
@zoffixznet - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#125998 (status was 'rejected')
Searchable as RT125998$
The text was updated successfully, but these errors were encountered: