rfc:prototype_checks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:prototype_checks [2011/09/19 11:40] – [Mismatch but theoretically compatible] colder | rfc:prototype_checks [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Request for Comments: | + | ====== Request for Comments: |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2011-09-19 | * Date: 2011-09-19 | ||
* Author: Etienne Kneuss < | * Author: Etienne Kneuss < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 16: | Line 16: | ||
==== Implementing abstract method ==== | ==== Implementing abstract method ==== | ||
+ | === Normal methods === | ||
The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error. | The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error. | ||
+ | === Constructors === | ||
+ | * In 5.3: No checks are performed | ||
+ | * In 5.4: The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error. | ||
==== Implementing interface method ==== | ==== Implementing interface method ==== | ||
+ | === All Methods === | ||
The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error. | The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a FATAL error. | ||
+ | |||
==== Overriding concrete method ==== | ==== Overriding concrete method ==== | ||
+ | === Normal methods === | ||
The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a STRICT error. | The prototype is checked with current normal rules (see Current rules). Any mismatch with current rules generates a STRICT error. | ||
+ | === Constructors === | ||
+ | No checks are performed. | ||
==== Overriding abstract method ==== | ==== Overriding abstract method ==== | ||
Line 127: | Line 132: | ||
function foo() | function foo() | ||
+ | |||
+ | ===== Topics worth discussing ===== | ||
+ | |||
+ | ==== Allow more theoretically valid modifications ==== | ||
+ | |||
+ | We have three wrong errors for modifications that should be accepted. Some of those might require more sophisticated checks than others, so not all might be worth including. | ||
+ | |||
+ | ==== Clarify the constructor problem ==== | ||
+ | Constructors can be seen as pseudo-static methods, for this reason, the same checks for normal methods do not always apply for constructors. | ||
+ | |||
+ | It is however unclear whether we really want, for constructors, | ||
+ | |||
+ | - Do we really want that check to be performed on 5.4 for constructors coming from abstract methods | ||
+ | - Do we really want the mismatch to result in a FATAL error (potential BC break coming from 5.3 where no checks were done) | ||
+ | |||
+ | |||
+ | ==== Similar prototypes from different interfaces ==== | ||
+ | It would be better to allow multiple interfaces to define the same intersection of prototype. It is currently not allowed in any case. | ||
+ | |||
+ | For example: | ||
+ | |||
+ | interface A { | ||
+ | function apply($a, $b); | ||
+ | // ... | ||
+ | } | ||
+ | | ||
+ | interface B { | ||
+ | | ||
+ | // ... | ||
+ | } | ||
+ | | ||
+ | class C implements A, B { .. } | ||
+ | |||
+ | This is currently not allowed, but there is no reason why it shouldn' |
rfc/prototype_checks.1316432434.txt.gz · Last modified: 2017/09/22 13:28 (external edit)