rfc:introduce-type-affinity
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:introduce-type-affinity [2015/03/16 22:04] – yohgaki | rfc:introduce-type-affinity [2015/03/16 23:04] – yohgaki | ||
---|---|---|---|
Line 8: | Line 8: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | PHP is weakly typed to make it work with Web smoothly. However, | + | PHP is weakly typed to make it work with Web smoothly. However, |
https:// | https:// | ||
Line 18: | Line 18: | ||
Since inputs are converted to native type. | Since inputs are converted to native type. | ||
- | * PHP does not have convert ZVAL again and again. (e.g. " | + | * PHP does not have to convert ZVAL again and again. (e.g. " |
- | * It works well with coercive type or strict type if PHP has it. | + | * It works well with coercive type or strict type if PHP has it. (Not work well with currently proposed " |
* User can omit simple data type validation and concentrate what data should like. | * User can omit simple data type validation and concentrate what data should like. | ||
Line 29: | Line 29: | ||
* Detect possible data type without definition/ | * Detect possible data type without definition/ | ||
- | * Have INI option for type affinity conversion | + | * Have INI option for type affinity conversion |
* Data is stored with native data type | * Data is stored with native data type | ||
* Conversion will never raise error | * Conversion will never raise error | ||
Line 40: | Line 40: | ||
Introduce type affinity conversion function: | Introduce type affinity conversion function: | ||
- | * void type_affinitize(mixed $input [, array $definition ]); | + | * void type_affinitize(mixed |
+ | * void type_affinitize_input(string $input=" | ||
- | Type affinity may be applied to any inputs including databases/ | + | Type affinity may be applied to any inputs including databases/$argv/etc. |
Please suggest other ways/ideas. Thank you. | Please suggest other ways/ideas. Thank you. | ||
Line 82: | Line 83: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | Type affinity can increase usefulness of strict | + | Type affinity can increase usefulness of strict |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== |
rfc/introduce-type-affinity.txt · Last modified: 2021/03/27 14:50 by ilutov