-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Introduce {bool exclusive = false} parameter to File.create({recursive}) method #49647
Comments
//cc @itsjustkevin |
Hey @aam please forgive my ignorance here, but is adding an additional parameter a breaking change if it has a default? There is usually a bit more context in these breaking change requests. |
@itsjustkevin yeah, unfortunately even adding optional parameter with default value is a breaking change since it will break all the code that implemented that class - potentially internal code that is used in testing, code that provided mock implementation of File class. Code that implemented File class with its own implementation of |
We should add |
Yeah, |
We should study the breaking change impact, but lgtm. |
This is to soften landing of a breaking change dart-lang/sdk#49647
…ethod. This is to soften landing of a breaking change dart-lang/sdk#49647
* Introduce stub of a exclusive parameter for File.create. This is to soften landing of a breaking change dart-lang/sdk#49647 * Fix format * Fix deprecated member use * Update pubspec.yaml, CHANGELOG.md
Submitted cl/468267059 to soften landing in g3. |
…ethod (#109646) * Introduce stubbed `exclusive` parameter to `File.create`-overridden method. This is to soften landing of a breaking change dart-lang/sdk#49647
👋 I'm not against the addition. I don't find the name very clear though
What about |
|
I understand that. A name like |
Thank you for your input @rrousselGit , getting to a consensus on naming can be hard as space is vast. It seems natural to me to interpret notion of cc @lrhn for more thoughts. |
Personally, at first glance I thought "exclusive" would be related to access rights. Even after learning about what this flag does, I still fail to see the relation between the flag name and the behavior. But English isn't my natural language. So if that's natural to others, ignore me 😊 |
Using the Posix flag name doesn't feel entirely right, because the API is not following the Posix structure otherwise (our I see some possible alternatives:
Not sure what users will want, though. It does feel mostly like it should be a flag on |
Thank you @lrhn . If I had to go for alternatives I would stay with the flag, yes, and pick |
Another option is change the orginal behavior of |
My approval did not consider the actual name and semantics. I'm fine with whatever name or API approach is most idiomatic for Dart. |
Given no more feedback on naming, going to submit the change as originally requested with |
Line 86, dart-lang#49647 is missing a link to the issue
Edit: Is the practice here to wait until the change rolls out with the next stable to update the docs? Are the api docs changes in a CL somewhere, not linked to this issue? |
@aam - just to confirm - this change will be in |
@devoncarew it's in latest beta(2.19.0-255.2.beta), so I assume yes. |
OK, for posterity, it looks like the first dev sdk with this change is We are seeing some failures w/ this change; I opened https://github.com/google/file.dart/issues/204 to track them, but to paraphrase that issue, older versions of package:file fail when run on newer SDKs. We can't fix the underlying issue (retroactively adjust the supported sdk version range of the older package:file versions) but can likely mitigate things by publishing new versions of packages that use package:file. |
…ile#199) * Introduce stub of a exclusive parameter for File.create. This is to soften landing of a breaking change dart-lang/sdk#49647 * Fix format * Fix deprecated member use * Update pubspec.yaml, CHANGELOG.md
Desktop OSs allow for a file to be created in exclusive mode enabling simple concurrency-serializing mechanism.
from https://man7.org/linux/man-pages/man2/open.2.html
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-wopen
This currently is not available for Dart apps.
This can be fixed via new optional
exclusive
parameter to https://api.flutter.dev/flutter/dart-io/File/create.html:The text was updated successfully, but these errors were encountered: