-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Update FilePath constructors to allow a non-partial way to create a FilePath #3819
Conversation
Closes #3820 |
I'm loiking forward to this one. |
@SeanTAllen This is (I believe) my first contribution to the stdlib so I am looking forward to it as well. I have all the tests passing now. I still need to add the additional test(s) for the change and want to look at stdlib/tests to see if I can reduce the size of try-blocks now that Also kind of surprised the following in ...
let parent: FilePath = match base
| let base': FileAuth => FilePath(base', dir)
| let base': FilePath => FilePath.from(base', dir)?
end
... I would expect |
new val mkdtemp(
base: (FilePath | AmbientAuth),
prefix: String = "",
caps': FileCaps val = recover val FileCaps .> all() end)
? and it would explain the working without a try. |
Ah, I was not thinking big enough. I had assumed the part I rewrote to now only sometimes failing would have bubbled up more, but at the function level it is already denoted as possibly failing. |
I finished the split of FilePath construction to be |
@rhagenson before this gets merged, can you update the first comment on this PR to be a good summation of the changes that this encompasses and link to the rfc? We'll use that as the squashed commit comment and if anyone follows the link from the CHANGELOG to this PR, they will find a good summary at the top. Please include Closes #3820 as part of that reworked comment. |
@rhagenson let me know if you would like any assistance with this. |
I will make a point to get all the suggested changes in place today. I have been wrapped up in other matters so have not gotten back to this. I recognize that y'all are waiting on me so moving it up in priority. I do not think I will need assistance. |
@rhagenson no rush. was checking, nothing more. |
@SeanTAllen Top comment rewritten and all direct mentions of Please let me know if there is anything else that is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I have left some comments below about the documentation blocks
examples/files/files.pony
Outdated
let auth = env.root as AmbientAuth | ||
with file = OpenFile( | ||
FilePath(env.root as AmbientAuth, env.args(1)?, caps)?) as File | ||
FilePath(auth, env.args(1)?, caps)) as File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change with let auth temporary variable should be reverted. it hides the "actual change".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
This looks good to me. I added one small change request and otherwise, I do agree with @ergl's couple of notes. Looking pretty good though. |
@ergl and @SeanTAllen I took at your comments into account. While fixing the removal of |
Closes #3820
As part of RFC 70,
FilePath
now has two constructors:create
andfrom
. Where previouslycreate
was a partial constructor and thus could fail if called with aFilePath
base, nowcreate
is a complete constructor and will always succeed. Partial construction withFilePath
now exists in thefrom
constructor.A new package-level root authority,
FileAuth
, has been added to allow explicit "files" authority withoutAmbientAuth
. This new authority follows the same convention as is used in the "net" package -- note: this change is different from the the accepted RFC in order to maintain consistency within stdlib 's use of package-level root authority. Any prior instance whereAmbientAuth
was accepted in relation toFilePath
now also acceptsFileAuth
with the same result.Additional tests have been added to cover the expected error behavior of
FileAuth.from(...)
, as well as the creation and use ofFileAuth
in place ofAmbientAuth
.