Re: [RFC] Path to Saner Increment/Decrement operators
| From: | Mark Baker | Date: | Fri, 20 Jan 2023 19:03:44 +0000 |
| Subject: | Re: [RFC] Path to Saner Increment/Decrement operators | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119384@lists.php.net to get a copy of this message | ||
On 20/01/2023 19:48, Kamil Tekiela wrote:
I don't think it's such a huge issue as you make it to be. The documentation states this only as an alternative: https://phpspreadsheet.readthedocs.io/en/latest/topics/accessing-cells/#looping-through-cells-using-indexes It also mentions the pitfalls. I doubt many users would prefer that "alternative" given that the recommended way is simpler and does the same thing. I also don't think that performance would come into play here. Any difference would be insignificant. I believe that the benefits of the deprecation outweigh any potential extra work the developers may have.I beg to differ. Having done a lot of work last year recommending the deprecation of using of column indexes (1,2,3,etc) in favour of addresses ('A', 'B', 'C', etc) to more closely match with Excel's layout; and knowing how much the codebase uses alpha column incrementing internally, I'm aware of how much an issue it is. I'd prefer if developers using PhpSpreadsheet used the built-in iterators, and Im in the middle of writing a post on the benefits of doing just that; but "under the hood" alpha column names are used, not numeric indexes'; so a lot of the "under the hood" code uses ++ and -- with row numbers and column addresses. And replacing any PHP operator with a function call is always going to be less performant. The benefits of this deprecation seem to be making ++ and -- consistent by making them little more than a syntactic sugar for numeric values only; I'm afraid I don't see that as a benefit; but as a retrograde step, and not the same as making ++ and -- consistent. -- Mark Baker