com php-langspec: Merge branch 'pull-request/141': spec/10-expressions.md

[email protected] (Stanislav Malyshev) Sat, 02 Jan 2016 02:28:06 +0000
Newsgroups php.standards.cvs
Message-ID <[email protected]>
Commit:    8608f11da671bf614dc3db934f535e51908b88e5
Author:    Stanislav Malyshev <[email protected]>         Fri, 1 Jan 2016 18:17:34 -0800
Parents:   79d439a0ee598761a246cf9bb9ff1521089a7c64 2faf48f771f8657f5e22f96c789b4b1fe1161136
Branches:  master

Link:       http://git.php.net/?p=php-langspec.git;a=commitdiff;h=8608f11da671bf614dc3db934f535e51908b88e5

Log:
Merge branch 'pull-request/141'

Changed paths:
  MM  spec/10-expressions.md


Diff:
diff --cc spec/10-expressions.md
index 97af190,efc985a..65305a3
--- a/spec/10-expressions.md
+++ b/spec/10-expressions.md
@@@ -773,9 -778,14 +778,12 @@@ $obj2 = clone $obj1;  // creates a new 
  **Defined elsewhere**
  
  * [*argument-expression-list*](#function-call-operator)
- * [*qualified-name*](09-lexical-structure.md#names)
+ * [*class-base-clause*](14-classes.md#class-declarations)
+ * [*class-interface-clause*](14-classes.md#class-declarations)
 -* [*class-member-declarations*](14-classes.md#class-members)
+ * [*class-members*](14-classes.md#class-declarations)
  * [*expression*](#general-6)
- 
+ * [*qualified-name*](09-lexical-structure.md#names)
 -* [*trait-use-clauses*](16-traits.md#trait-declarations)
+  
  **Constraints**
  
  *qualified-name* must name a class.
@@@ -790,8 -800,7 +798,7 @@@ as many as the number of non-optional p
  
  **Semantics**
  
- The `new` operator creates an object that is an instance of
- the class specified by *class-type-designator*.
 -The `new` *class-type-designator* forms create an object of the class type specified by *class-type-designator*. The `new class` forms create an object of an *anonymous class type*, a type that has no name that can be written in source code. In all other respects, however, an anonymous class has the same capabilities as a named class type.
++The `new` *class-type-designator* forms create an object of the class type specified by *class-type-designator*. The `new class` forms create an object of an *anonymous class type*, a type that has an unspecified name. In all other respects, however, an anonymous class has the same capabilities as a named class type.
  
  If the *class-type-designator* is an expression resulting in a string value,
  that string is used as the class name. If the expression results in an object,
@@@ -810,8 -819,9 +817,10 @@@ passing it the optional *argument-expre
  constructor, the constructor that class inherits (if any) is used. The class
  can also specify no constructor definition, in this case the constructor call is omitted.
  
- The result of an *object-creation-expression* is an object
- of the type specified by *class-type-designator*.
 -The result of a named-type *object-creation-expression* is an object of the type specified by *class-type-designator*. The result of an anonymous class object-creation-expression is an object of unspecified type. 
++The result of a named-type *object-creation-expression* is an object of the type specified by *class-type-designator*. The result of an anonymous class *object-creation-expression* is an object of unspecified type. However, this type will subtype all types
++provided by *class-base-clause* and *class-interface-clause* and the *class-members* definition should follow the same inheritance and implementation rules as the regular [class declaration](14-classes.md#class-declarations) does.
+ 
 -Each distinct source code expression of the form `new class` results in an instance of an unspecified class type that is different from that of all other anonymous class types. However, multiple evaluations of the same source code expression of the form `new class` result in instances of the same, unspecified class type.
++Each distinct source code expression of the form `new class` results in the class type that is different from that of all other anonymous class types. However, multiple evaluations of the same source code expression of the form `new class` result in instances of the same class type.
  
  Because a constructor call is a function call, the relevant parts of
  [function call operator](#function-call-operator) section also apply.
@@@ -831,6 -841,11 +840,12 @@@ $p1 = new Point;     // create Point(0
  $p1 = new Point(12);   // create Point(12, 0)
  $cName = 'Point';
  $p1 = new $cName(-1, 1); // create Point(-1, 1)
+ // -----------------------------------------
+ $v2 = new class (100) extends C1 implements I1, I2 {
+ 	public function __construct($p) {
+ 	    echo "Inside class " . __CLASS__ . " constructor with parameter $p\n";
++	}
+ };
  ```
  
  ###Array Creation Operator