-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Built-in function for chaining types to provide inside Bear.run() as annotation #1859
Comments
Would it be enough to have a helper function that does this job inside the function instead of verifying at the function prototype definition? Example:
And |
the thing is if we have it as the annotation then coala will auto convert Sincerely, Lasse Schuirmann contact@viperdev.io 2016-03-13 13:28 GMT+01:00 Adhityaa Chandrasekar notifications@github.com:
|
No, we can let the function raise an error if the variable doesn't match the type. The user doesn't need to do anything IMO. |
Having this inside the signature is way better since coala is then able to provide more help for that bear. Inside the body coala can't influence/see anything. Also your |
Is a function prototype like
make the enforced variable types available to bear help? |
right now it's more:
and coala will always give the bear an int and a float, if conversion is not possible the bear won't be executed |
Where does this function have to live? |
I think StringConverter would be the right place |
@sils1297 what about directly inside Bear? since it's general purpose type-chaining^^ |
it's general purpose, it's not at all tied to bears |
I want to get assigned :) |
Originated from #1855, where multiple-types shall be supported. coala already has a way to define your own parsing function:
The task of this issue to implement a generic function that works like this:
So it takes a sequence of types and tries to parse them in order. If nothing works, raise a
ValueError
.The text was updated successfully, but these errors were encountered: