Hey All

On 01.02.23 07:20, Mark Baker wrote:
On 23/01/2023 14:06, G. P. B. wrote:
However, the whole point of this RFC is to*remove*  cognitive burden for
developers, so they don't even need to be aware of this "feature" and not
get surprised when it kicks in.

Moreover, by your logic, you wouldn't care if we removed support for
alphanumeric strings and only let the PERL increment kick in for purely
alphabetical.
While convenient for you, someone might actually use this feature on
alphanumeric strings, and we're back to "why is my use case being removed
while that other just as weird one remains".

I make no judgement on alphanumeric strings, other than I can't see any use case for it myself, so I won't allow my objection be considered hypocritical; and your definition of my use case as "weird" is highly judgemental.


Bijective numeration using the letters of the alphabet has a long and ancient tradition, pre-dating our modern numeric Hindu-Arabic system using base 10 for place/value notation by many centuries. The Abjadi system used the 28 letters of the Arabic alphabet; similarly the ancient Greeks and Hebrews, the Armenians; by Russia until the early 18th Century (each culture using their own alphabet). It's ironic that the Romans used a very different system, even though our modern western alphabet is based on the Roman alphabet.

These civilisations didn't consider their alphabetic numeral system "weird".


How many of the irregularities and idiosyncracies of alphanumeric strings could be resolved by not trying to cast them as a numeric value before increment/decrement; but by treating them consistently as strings? It would resolve the discrepancy with "5d9"; although not with "0xf9".

The thing that I consider "weird" and that I would really love to see addressed in a future version of PHP is that the increment of strings only works with a-z|A-Z while there are a lot of other alphabets where that should work similar. See https://3v4l.org/k0Nti for such an example.

Incrementing a *string* is something that people should only do when they know what they are doing. That numeric strings are incremented one way and other strings another one is indeed something that can irritate people. And due to the missing type-system in former times it made sense. But given the by now available type-system using a "sane" increment could be as easy as `++(int)$var`.

That way it is clear that whatever is in the variable $var should be treated as integer (or float) and be incremented after the conversion

That way the already existing feature - it is clearly specified in the documentation and seems to be specified there for the last 20+ years - would stay the same while still allowing people to easily make sure that the increment way they expect is used.

Yes! That would mean that `$i = "9"; echo ++$i` would output `A`, whereas `echo ++(int)$i` would output `10`. But I find that very intuitive and sane.

Just my 0.02€

Cheers

Andreas


--
                                                               ,,,
                                                              (o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl                                                       |
| mailto:andr...@heigl.org                  N 50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org                                           |
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas                               |
+---------------------------------------------------------------------+
| GPG-Key: https://hei.gl/keyandreasheiglorg                          |
+---------------------------------------------------------------------+

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to