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

Fix IO::Path.absolute/.relative to return IO::Path #666

Closed
wants to merge 1 commit into from
Closed

Fix IO::Path.absolute/.relative to return IO::Path #666

wants to merge 1 commit into from

Conversation

ugexe
Copy link
Member

@ugexe ugexe commented Jan 2, 2016

http://doc.perl6.org/type/IO::Path technically says a new IO::Path, so someone more familiar with the path caching may want to take it one step further.

http://doc.perl6.org/type/IO::Path technically says `a new IO::Path`, so someone more familiar with the path caching may want to take it one step further.
@niner
Copy link
Collaborator

niner commented Jan 2, 2016

The speculations use a Str return type for .absolute and .relative. Though I'd personally like these methods to return IO::Path objects for consistency if nothing else, this would be a backwards incompatible change that should not be made lightly this side of christmas. So I'd say we first have to figure out, how to implement a 6.d version where this change can be included.

@ugexe
Copy link
Member Author

ugexe commented Jan 2, 2016

abspath would seem to serve no purpose in that case as both return the same string with 0 arguments

@niner
Copy link
Collaborator

niner commented Jan 2, 2016

abspath is also missing from the speculations. Probably because it's redundant and an implementation detail really.
I would actually like to know what lizmat++'s plan for that in the newio branch was.

@Leont
Copy link
Contributor

Leont commented Jan 6, 2016

I'm surprised (and somewhat horrified) it does this :-(

@AlexDaniel
Copy link
Contributor

@AlexDaniel
Copy link
Contributor

@zoffixznet zoffixznet self-assigned this Mar 14, 2017
@zoffixznet
Copy link
Contributor

Rejecting this.

The .absolute/.relative methods are basically a way to fine-tune how to an IO::Path is stringified. Since relative IO::Paths are relative to their $!CWD attribute and not the current $*CWD there's no tangible difference between absolute and relative IO::Path objects, so returning an IO::Path object from these methods is pointless.

-- IO grant

@zoffixznet zoffixznet closed this Mar 24, 2017
@Leont
Copy link
Contributor

Leont commented Apr 11, 2017

The .absolute/.relative methods are basically a way to fine-tune how to an IO::Path is stringified. Since relative IO::Paths are relative to their $!CWD attribute and not the current $*CWD there's no tangible difference between absolute and relative IO::Path objects, so returning an IO::Path object from these methods is pointless.

I would disagree. For one I would expect their stringification to be different (and consider this useful).

@zoffixznet
Copy link
Contributor

zoffixznet commented Apr 11, 2017

Stringification with methods other than .absolute/.relative does not take $!CWD into account, so these methods are the only ones you can use for that purpose, if you wish to reliably use the stringified results as paths to access some filesystem entity.

It might've been better to make .Str not have this caveat and work as either .absolute or .relative, but I can think of reasons to why keeping it the way it is is DWIMMY. And such a change was on the table for the IO grant work, but was ultimately rejected.

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

Successfully merging this pull request may close these issues.

None yet

6 participants