rfc:nullable-casting
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:nullable-casting [2019/04/06 07:45] – Change Status to Under Discussion guilliamxavier | rfc:nullable-casting [2019/04/21 09:03] (current) – Add Discussion section guilliamxavier | ||
---|---|---|---|
Line 175: | Line 175: | ||
* Working prototype: https:// | * Working prototype: https:// | ||
+ | |||
+ | ===== Discussion ===== | ||
+ | |||
+ | ==== "Not 100% needed" | ||
+ | |||
+ | Current alternatives: | ||
+ | * Use a test (ternary conditional operator or '' | ||
+ | * Write (and [auto]load) custom casting functions | ||
+ | * Disable (i.e. do not enable) strict typing mode in the concerned file //(not strictly equivalent, e.g. for '' | ||
+ | |||
+ | ==== "A cast where you can't be sure of what you'll get back" ==== | ||
+ | |||
+ | "I understand the use-case for when you want to pass something to a nullable parameter, but if you think about this cast in isolation, it hardly makes sense." | ||
+ | |||
+ | ==== "What about e.g. nullable_intval()?" | ||
+ | |||
+ | But we're missing " | ||
+ | |||
+ | ==== Fallible Casting ==== | ||
+ | |||
+ | One might expect to also have e.g. '' | ||
+ | |||
+ | ==== Alternative syntax ==== | ||
+ | |||
+ | E.g. "'' | ||
===== References ===== | ===== References ===== | ||
Line 181: | Line 206: | ||
* PHP RFC: [[rfc: | * PHP RFC: [[rfc: | ||
* Initial idea and discussion: https:// | * Initial idea and discussion: https:// | ||
+ | * Annoucement and discussion: https:// |
rfc/nullable-casting.1554536745.txt.gz · Last modified: 2019/04/06 07:45 by guilliamxavier