-
Notifications
You must be signed in to change notification settings - Fork 146
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
Ambiguity in asynchronous execution setting #27
Comments
@Temikus I like this a lot; I've noticed this as well. However, I don't believe your proposed solution is possible until we've dropped support for Ruby 1. Until then, we'd have to take an optional hash argument instead of using a named parameter. Fog has no plans to drop support for Ruby 1.9, (only 1.8,) as far as I know. @plribeiro3000 is there precedent for this in other |
Regardless of implementation, this is a breaking change, so I've marked it for v1.0.0. |
@ihmccreery we are following the main repo conventions. I believe this would give us less issues like a provider that supports a ruby version that the main one does not. For now we will have to keep all |
@plribeiro3000 Sorry, that wasn't clear. I know we need to keep support for 1.8.7 until |
Oh, gotcha. I'm not sure about conventions on this one but usually @geemus always ask to drop boolean params that change the behavior of the method. I tend to agree and define 2 methods with proper names to indicate the exact behavior of each one. Does that answer your question? (Sorry for the miss on the first attempt) |
Yeah, tricky. I think as @plribeiro3000 suggests, we could add |
I agree with separating into methods. It seems better than implementing hash option fetching. |
Hm. Separate methods are generally a good thing, I think, but it does mean we won't be able to wrap blocks in async_execution = false
instance.destroy(async_execution) Whatever we decide, I think it makes sense to see a deprecation warning in v0.1.0, and full removal of the current behavior in v1.0.0, which hopefully would sync with |
But that's what I was saying.
It reads "set the async_execution to false", "destroy instance with async execution". Which is super confusing. If we had the sync which amounted to true, however, it would still be a bit less readable, but would actually make sense logically, as in:
or
|
Yeah, I see what you're saying. Would just a simple variable rename, like sync_execution_switch = false
instance.destroy(sync_execution_switch) or, in params world sync_execution_switch = false
instance.destroy(:async => sync_execution_switch) solve the issue? I'm could also imagine something more involved, like instance.sync { instance.destroy } versus instance.async { instance.destroy } but that's a pretty big syntax change. To be clear, I think this should change, I'm just skeptical about the multiple method names. That said, I'm happy to be overruled. |
I think we can just reformat this as a positional parameter across the board. Game plan for 2.0:
For 3.0:
The only thing I'm concerned about is if there are any weird corner cases with mixing positional and named parameters... @icco WDYT? |
Seems like a solid plan @Temikus |
This issue has been marked inactive and will be closed if no further activity occurs. |
While figuring out acceptance tests for vagrant-google, I found a weird logic piece in the implementation of synchronous operations in Fog.
As an example, let's take a look at Server class' destroy method:
The async parameter is just a true/false switch, so if we need to perform the operation synchronously (important for tests for example), we need to specify it like so:
Which, I find highly confusing to understand for someone who's reading the code later.
Due to the default being true, it is not easy to wrap around with a statement, since it will not make any sense either:
I was wandering - maybe it makes sense to make it a named parameter?
This will allow for:
The text was updated successfully, but these errors were encountered: