rfc:proper-range-semantics
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
rfc:proper-range-semantics [2023/05/08 09:24] – Clarification nits girgias | rfc:proper-range-semantics [2023/05/08 14:31] – Fix grammar in several places theodorejb | ||
---|---|---|---|
Line 24: | Line 24: | ||
* If both start and end values are strings with at least one byte (e.g. < | * If both start and end values are strings with at least one byte (e.g. < | ||
- | * If one of the inputs is a float numeric string, or the < | + | * If one of the inputs is a float numeric string, or the < |
- | * If one of the inputs is an integer numeric string: go to the generic handling branch | + | * If one of the inputs is an integer numeric string: go to the generic handling branch. |
* Otherwise: discard every byte after the first one and return an array of ASCII characters going from the start ASCII code point to the end ASCII code point. | * Otherwise: discard every byte after the first one and return an array of ASCII characters going from the start ASCII code point to the end ASCII code point. | ||
- | * If one of the start or end value is a float or the < | + | * If the start or end value is a float or the < |
- | * Otherwise (generic handling): cast start and end values to int and return an array of int. | + | * Otherwise (generic handling): cast start and end values to int and return an array of integers. |
| | ||
The generic case will accept //any// type. | The generic case will accept //any// type. | ||
Line 322: | Line 322: | ||
==== Issues surrounding usage of INF and NAN values ==== | ==== Issues surrounding usage of INF and NAN values ==== | ||
- | Infinite values are handles | + | Infinite values are handled |
However, NAN values are not specifically handled and result in nonsensical ranges: | However, NAN values are not specifically handled and result in nonsensical ranges: | ||
Line 339: | Line 339: | ||
</ | </ | ||
- | Where using a NAN values | + | Where using a NAN value as a step even breaks the expectation that < |
Line 349: | Line 349: | ||
* If < | * If < | ||
- | * Introduce and use a proper ZPP check for '' | + | * Introduce and use a proper ZPP check for '' |
* Throw value errors if < | * Throw value errors if < | ||
* Throw a more descriptive < | * Throw a more descriptive < | ||
Line 436: | Line 436: | ||
< | < | ||
- | Calls to < | + | Calls to < |
<PHP> | <PHP> | ||
var_dump( range(1, 5, 2.0) ); | var_dump( range(1, 5, 2.0) ); |
rfc/proper-range-semantics.txt · Last modified: 2023/06/19 13:41 by girgias