rfc:dbc2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:dbc2 [2015/02/10 12:52] – krakjoe | rfc:dbc2 [2018/03/01 23:19] (current) – Typo "Under Discussion" carusogabriel | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2015-02-10 | * Date: 2015-02-10 | ||
* Author: Yasuo Ohgaki < | * Author: Yasuo Ohgaki < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Important Note ===== | ===== Important Note ===== | ||
+ | |||
+ | This RFC is part of " | ||
+ | * https:// | ||
This RFC is an alternative approach to " | This RFC is an alternative approach to " | ||
- | http:// | + | * http:// |
Contracts can be defined without modification to the language, however, the D documentation calls the resulting implementation " | Contracts can be defined without modification to the language, however, the D documentation calls the resulting implementation " | ||
Line 70: | Line 73: | ||
===== Invariant ===== | ===== Invariant ===== | ||
- | Invariant contracts are declared using **require** inside class body. Multiple contracts may be used. They may access object or static properties through **$this** and **self**. Invariant contracts may be used for classes, abstract classes and traits, but not for interfaces. | + | Invariant contracts are declared using **require** inside class body. Multiple |
< | < | ||
Line 82: | Line 85: | ||
} | } | ||
- | requre($this-> | + | require($this-> |
} | } | ||
</ | </ | ||
Line 102: | Line 105: | ||
</ | </ | ||
- | **Invariants | + | **Invariant contracts |
====Contracts Inheritance Rules==== | ====Contracts Inheritance Rules==== | ||
Line 108: | Line 111: | ||
Contracts are constant, this has the following implications: | Contracts are constant, this has the following implications: | ||
- | * a derived class must satisfy | + | * a derived class must satisfy |
* a derived class overriding a method must satisfy the pre and post condition contracts of it's prototype. | * a derived class overriding a method must satisfy the pre and post condition contracts of it's prototype. | ||
Line 147: | Line 150: | ||
* dbc=zero_cost - don't generate code for contracts. This may be set only in php.ini and can't be changed through ini_set(). | * dbc=zero_cost - don't generate code for contracts. This may be set only in php.ini and can't be changed through ini_set(). | ||
- | The default value if " | + | The default value is " |
- | ===Contracts | + | ===Contracts |
If " | If " | ||
- | - all require() contracts (preconditions) defined for this methods | + | - all require() contracts (precondition) defined for this function |
- | - all require() contracts (invariants) defined | + | - all require() contracts (invariant) for this class and parents |
- method body | - method body | ||
- | - all require() contracts (invariants) defined | + | - all require() contracts (invariant) for this class and parents |
- | - all return() contracts (postconditions) defined for this methods | + | - all return() contracts (postcondition) defined for this function |
**Invariant and Special Methods** | **Invariant and Special Methods** |
rfc/dbc2.1423572737.txt.gz · Last modified: 2017/09/22 13:28 (external edit)