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

Option<T> and implicit conversion #25

Open
mickvikt opened this issue Mar 19, 2021 · 2 comments
Open

Option<T> and implicit conversion #25

mickvikt opened this issue Mar 19, 2021 · 2 comments

Comments

@mickvikt
Copy link

Hello,
It would be really nice if one could configure Option not to do implicit conversion from a value to Some(value). Sometimes declaring intent explicitly is really useful. Is that possible?

Thank you.

@petriashev
Copy link
Member

This behaviour is the same as in one of the most featured lib LanguageExt.
It allows easily convert ordinary method to optional with minimal code changes and back. The same is for result return type - you can return one type or another.

What is your use case when you dont need implicit conversion?

@mickvikt
Copy link
Author

Well, it lacks explicit clearness when you're, say, doing a code review on Azure DevOps pull request, an Option variable is declared earlier and all you see further down the code is:

someVariable = 42

This gives no indication of intent that this is an Option and not a simple int.

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

No branches or pull requests

2 participants