rfc:alternative-closure-use-syntax

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
rfc:alternative-closure-use-syntax [2019/06/15 21:44] – created wesnetmorfc:alternative-closure-use-syntax [2019/06/15 21:57] wesnetmo
Line 10: Line 10:
  
 PHP users often say that they find defining the lexical-scope imports cumbersome, because PHP users often say that they find defining the lexical-scope imports cumbersome, because
-they hate writing the variables explicitly. My (updated) opinion on the matter is that +they hate writing the variables explicitly. 
-what's actually annoying is not having to write the variable names, but the syntax + 
-with which the imports are defined. In ES we are forced to declare variables and we don't +My (updated) opinion on the matter is that what's actually annoying is not having to write 
-find it annoying; in PHP we don't have to declare variables, but we are required to +the variable names, but the syntax with which the imports are defined. 
-specify which one we want to import in ''Closure''s. It won't be much different if not for + 
-the syntax.+In ES we are forced to declare variables and we don't find it annoying; in PHP we don't 
 +have to declare variables, but we are required to specify which one we want to import in 
 +''Closure''s. It won't be much different if not for the syntax. It is very standard in ES, 
 +but irksome in PHP.
  
 Specifically, it requires a lot of effort to write compared to normal expressions. Specifically, it requires a lot of effort to write compared to normal expressions.
-Whitespace, parentheses, probable indentation on different depths. Also, being in the+Whitespace, parentheses, possible indentation on different depths. Also, being in the
 middle of the signature, it is very invasive, visually, as it separates the arguments from middle of the signature, it is very invasive, visually, as it separates the arguments from
 the return information: the return information:
Line 74: Line 77:
     ): ReturnType {     ): ReturnType {
         use $importVariable1, &$importVariable2, $importVariable3, &$importVariable4;         use $importVariable1, &$importVariable2, $importVariable3, &$importVariable4;
 +        
 +        // ...
     };     };
  
Line 86: Line 91:
         use $importVariable1, &$importVariable2;         use $importVariable1, &$importVariable2;
         use $importVariable3, &$importVariable4;         use $importVariable3, &$importVariable4;
 +        
 +        // ...
     };     };
 </PHP> </PHP>
Line 103: Line 110:
         echo 123;         echo 123;
         use $importVariable3, &$importVariable4;         use $importVariable3, &$importVariable4;
-        // ^ syntax error, as use can only be preceded by other use statements+        // ^ syntax error, as "usecan only be preceded by other "usestatements
     };     };
 </PHP> </PHP>
Line 123: Line 130:
  
 Vote will require 2/3 majority Vote will require 2/3 majority
- 
-===== References ===== 
- 
-  * abc 
-  * def 
- 
rfc/alternative-closure-use-syntax.txt · Last modified: 2019/06/16 12:03 by wesnetmo