rfc:code_free_constructor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:code_free_constructor [2019/01/23 13:41] rjhdbyrfc:code_free_constructor [2019/01/28 07:18] rjhdby
Line 55: Line 55:
 class MyCustomMotorCycle($cc, $whells) extends MotorCycle("Custom", $cc){ }; class MyCustomMotorCycle($cc, $whells) extends MotorCycle("Custom", $cc){ };
 </code> </code>
 +
 +{{:rfc:joined.png?400|}}
  
 By the way, current realization simply add "_ _construct" method into class via AST injection.  By the way, current realization simply add "_ _construct" method into class via AST injection. 
Line 62: Line 64:
 class MyCustomMotorCycle(int $cc, int $whells = 3, ...$otherParams) extends MotorCycle("Custom", $cc){ }; class MyCustomMotorCycle(int $cc, int $whells = 3, ...$otherParams) extends MotorCycle("Custom", $cc){ };
 </code> </code>
 +
 +===== Restrictions =====
 +This syntax can't be used with anonymous classes because those classes instantiated at once they declared and same syntax is used for forwarding parameters directly into constructor.
  
 ===== Possible Issue ===== ===== Possible Issue =====
Line 108: Line 113:
  
 Draft implementation, need to be reviewed. Draft implementation, need to be reviewed.
-https://github.com/php/php-src/compare/master...rjhdby:constructor+https://github.com/rjhdby/php-src/compare/master...rjhdby:constructor
  
 ===== References ===== ===== References =====
  
  
rfc/code_free_constructor.txt · Last modified: 2019/01/29 12:17 by rjhdby