rfc:compact-object-property-assignment

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
Last revisionBoth sides next revision
rfc:compact-object-property-assignment [2020/03/28 21:32] jgivonirfc:compact-object-property-assignment [2020/04/02 01:56] – Replaced instance of `=>` with `=` jasny
Line 6: Line 6:
   * Date: 2020-03-17   * Date: 2020-03-17
   * Author: Jakob Givoni <jakob@givoni.dk>   * Author: Jakob Givoni <jakob@givoni.dk>
-  * Status: Under [[https://externals.io/message/109055|Discussion]]+  * Status: Voting -[[https://externals.io/message/109055|externals discussion link]]
  
 ===== Introduction ===== ===== Introduction =====
Line 18: Line 18:
 As an alternative to writing a data structure as an associative array, COPA gives the data a **//documented signature//** so that you know what parameters are expected and their value types. As an alternative to writing a data structure as an associative array, COPA gives the data a **//documented signature//** so that you know what parameters are expected and their value types.
  
-> COPA does not introduce any new concepts or complexities, but merely a new syntax aimed at making thousands of PHP developers write their code in a simpler way. The code becomes easier to write and read and thus more maintainable without any lateral limitations or factual downsides.+> COPA does not introduce any new concepts or complexities, but merely a new syntax aimed at making millions of PHP developers write their code in a simpler way. The code becomes easier to write and read and thus more maintainable without any lateral limitations or factual downsides.
  
 ==== Example ==== ==== Example ====
Line 153: Line 153:
 <code php> <code php>
 (new Foo)->[ (new Foo)->[
-    om ='get',+    om = 'get',
     mane = 'a',     mane = 'a',
     hum = (new Foo)->[     hum = (new Foo)->[
Line 422: Line 422:
 ); );
 </code> </code>
 +=== Syntax F ===
 +
 +**WITH** syntax
 +
 +<code php>
 +myObj.with {
 +     foo = 10
 +     bar = foo + 20
 +}
 +</code>
 +If this is the preferred syntax it will require a new RFC.
 +
 ===== Rejected Features ===== ===== Rejected Features =====
  
Line 452: Line 464:
 > **Note!** Chaining method calls is not an atomic operation either. The cost/benefit of implementing “transaction” and “rollback” behavior is negative. > **Note!** Chaining method calls is not an atomic operation either. The cost/benefit of implementing “transaction” and “rollback” behavior is negative.
  
-===== Proposed Voting Choices =====+===== Vote ===== 
 + 
 +Voting starts 2020-03-31 and ends 2020-04-13.
  
 The primary vote of whether or not to accept this RFC requires a 2/3 majority. The primary vote of whether or not to accept this RFC requires a 2/3 majority.
  
-A secondary “vote” directed at no-voters, will ask you the primary reason for voting “No”.+<doodle title="Would you like to add support for COPA?" auth="jgivoni" voteType="single" closed="false"> 
 +   * Yes 
 +   No 
 +</doodle>
  
-The options will be:+\\
  
-  I voted yes! +<doodle title="If you voted no, what was the main reason?" auth="jgivoni" voteType="single" closed="false"> 
-  I don’t find the feature useful +   I voted yes! 
-  I don’t like the syntax +   * I don’t find the feature useful 
-  I prefer a more comprehensive solution to this problem +   * I don’t like the syntax 
-  I prefer a narrower solution to this problem +   * I prefer a more comprehensive solution to this problem 
-  This breaks backwards compatibility +   * I prefer a narrower solution to this problem 
-  This will negatively limit future changes +   * This breaks backwards compatibility 
-  This will be a nightmare to implement and maintain +   * This will have negative implications for future language evolution 
-  I prefer not to say+   * This will be a nightmare to implement and maintain 
 +   * I prefer not to say 
 +</doodle>
  
-This will help understand what the obstacles are, when studying this RFC in the future, should anyone be tempted to have another shot at object literals et. al.+\\
  
-There could be a 3rd vote on alternative syntaxes.+<doodle title="If you did not like the proposed syntax, which alternative would you prefer?" auth="jgivoni" voteType="single" closed="false"> 
 +   * A (the proposed one) 
 +   * B 
 +   * C 
 +   * D 
 +   * E 
 +   * F 
 +   * Irrelevant 
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/compact-object-property-assignment.txt · Last modified: 2020/04/14 06:30 by jgivoni