Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Implicit conversions from Foo? to Foo are a major footgun, because the point of returning a Foo? is to have the caller check for failure before assuming there's a Foo to use. Even C++ avoids the implicit conversion from optional<T> to T.


Does C++ support implicit coercion from T to optional<T>? I think it doesn't, but that would be the corresponding case.


Yes, but they were describing an implicit conversion going the other way around, eg. String <: String?.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: