A simple example:
class Dog { function getColor() { if (isSet($this->color)) return $this->color; return "brown"; } } Here the default color for dogs is "brown".
With default reasoning it is not a value that has a default, but some . This term comes from Artificial Intelligence research. The most common example of default reasoning in is inheritance: when a class does not define a certain method of its own, a method with the same name of its parent class is used. Thus, the behavior of the child class defaults to the behavior of the parent class.
Default reasoning is used extensively in phpPeanuts: A produces default for a if there is no getter method, the user interfacing produces a default if there is no special page class defined, it uses a default US-style number format if no number format has been defined, etc. etc. |