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

Well, yes, of course. The thing you could previously rely on being present can no longer be guaranteed to be present - that _should_ require code in the calling function to change.


Not if I loosened the requirement. Stricter adherents shouldn't have to change anything. This is poor language ergonomics.


To be clear, you're talking about the function signature changing from

    fn(a: int)
to

    fn(a: Option<int>)
?

Technically, yes, all callers would have to update, but practically, you'd just define

    fn(a: int) { fn_2(Some(a)) }
to avoid the breakage. That is, you're essentially telling the compiler how to loosen the requirements. Ergonomically, this seems rather fine. Especially if this means you gain (some) protections from the much more problematic case of restricting the requirements.


There is also the Option of accepting Into<Option<T>>, which does cover both variants and is completely backwards compatible.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: