Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
tlb
on March 29, 2025
|
parent
|
context
|
favorite
| on:
You Need Subtyping
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.
kragen
on March 29, 2025
|
next
[–]
Does C++ support implicit coercion from T to optional<T>? I think it doesn't, but that would be the corresponding case.
naasking
on March 29, 2025
|
prev
[–]
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: