rfc:closures_in_const_expr
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:closures_in_const_expr [2024/10/29 12:54] – timwolla | rfc:closures_in_const_expr [2024/12/02 17:27] (current) – Implemented timwolla | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2024-10-24 | * Date: 2024-10-24 | ||
- | * Author: Tim Düsterhus, tim@tideways-gmbh.com | + | * Author: Tim Düsterhus |
- | * Status: | + | * Status: |
+ | * Target Version: PHP 8.5 | ||
+ | * Implementation: | ||
* First Published at: https:// | * First Published at: https:// | ||
Line 45: | Line 47: | ||
* Attribute parameters. | * Attribute parameters. | ||
- | * Default values of properties, parameters, | + | * Default values of properties and parameters. |
* Constants and Class Constants. | * Constants and Class Constants. | ||
Line 52: | Line 54: | ||
If Closures are placed in constant expressions they are subject to the following constraints: | If Closures are placed in constant expressions they are subject to the following constraints: | ||
- | * They may not include variables from the surrounding scope using < | + | * They may not include variables from the surrounding scope using < |
- | * They must be < | + | * They must be < |
+ | |||
+ | Both of these constraints will be verified at compile time. | ||
==== Scoping ==== | ==== Scoping ==== | ||
Line 90: | Line 94: | ||
</ | </ | ||
- | Passing a Closure to a new expression: | + | Passing a Closure to a <php>new</ |
<PHP> | <PHP> | ||
Line 138: | Line 142: | ||
</ | </ | ||
- | Custom formatting for an attribute-based | + | Custom formatting for an attribute-based |
<PHP> | <PHP> | ||
Line 196: | Line 200: | ||
* Support non-static Closures. | * Support non-static Closures. | ||
* Support first-class callables. | * Support first-class callables. | ||
+ | * Support variable capturing if/when variables may appear in constant expressions. | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | <doodle title=" | + | <doodle title=" |
* Yes | * Yes | ||
* No | * No | ||
Line 210: | Line 215: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | n/a | + | https:// |
===== References ===== | ===== References ===== | ||
Line 217: | Line 222: | ||
* https:// | * https:// | ||
* [[rfc: | * [[rfc: | ||
+ | * https:// | ||
===== Rejected Features ===== | ===== Rejected Features ===== | ||
n/a | n/a |
rfc/closures_in_const_expr.1730206466.txt.gz · Last modified: 2024/10/29 12:54 by timwolla