Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119327 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89151 invoked from network); 18 Jan 2023 17:57:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Jan 2023 17:57:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 983291804A9 for ; Wed, 18 Jan 2023 09:57:28 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Jan 2023 09:57:28 -0800 (PST) Received: by mail-ej1-f51.google.com with SMTP id v6so42167719ejg.6 for ; Wed, 18 Jan 2023 09:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=9RmtiKNBwD8ztvMXjnAcHxOako7eiQVyGJXvb6VV13Q=; b=YNKeNN185SBsoPQJWJgQWoaCa8vumehgUKco9stCQg+1LAx9Hdst5cz5HmwOl1DaIK RMpeT4KJFzcmJKKRVoZZ+mjqwXvVhAfSv1J9U/dei+H7pJD06Eq+B+YGt81Rx+MFy+9d XOwp7LDtWAguOs0fYO1yBKv0IUseg2qL65n8NCqkKM7Rw6YMkw2JGxr+9aapbtTqAAI5 0GSf6Q2KBNY/f0ZTZ6dlRbjxA9tUZ9JssSLYRAlAy6LJWi0/kryxcQKz5vodDNdrDyhU NG2VqELlzgwNj7ozG3evJ7qdAcGBE5bIwt16S9OIksb6HEdlucm5jcQZbp7AJI8RtWxA 0Swg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9RmtiKNBwD8ztvMXjnAcHxOako7eiQVyGJXvb6VV13Q=; b=X1ajjFJ9z25KvVEZ+Fr0GN6ucgRt1OE0EkpL3+Gv43QIliihqa8GDgoFFprl7d+peq D/H+NIZhOVdAElcdNL9Ki9D0i9SdstHsY1gxMhNTaXKu3gOYwmD0G+rhwrcnHGBt3XNY LlHw+ppAVFgGH7q8++l5b/4BDLLv+pHqI4eqllCBJ9paO6rQzTOiA5FgJSPSzjBmymap 61FnftgIPlbHRI+NM3cm9nYJ8uYg4fOUYoQJacMDn7+rFXiywjayt4V/cSJYb+bh+95U 6fyBZ7o7hfcW/v71mKrC5vuFoxYqZCcQY+Hk5KDRLsADF7u24IXb8qBp3Fdb+hxOpT3K J9eA== X-Gm-Message-State: AFqh2kpXDHkoDFgZXsnZxaXfg7PQoNvqZulpgBht5Nc6x1Dm51CrX5m6 6T0mxE9034qT/Jr9KHCUdBY= X-Google-Smtp-Source: AMrXdXsQaqSIS/ymBIGnMRPf1DTExdgikZCa7AZnl1IXleXuC5p8TfcKy0y5PSTZPW0r+xVgOmPQaQ== X-Received: by 2002:a17:907:8b96:b0:865:db90:1fd8 with SMTP id tb22-20020a1709078b9600b00865db901fd8mr8936831ejc.61.1674064646733; Wed, 18 Jan 2023 09:57:26 -0800 (PST) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id ui18-20020a170907c91200b00872c3e8d4e0sm2694889ejc.13.2023.01.18.09.57.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2023 09:57:26 -0800 (PST) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_A01A2FEE-2324-457E-87B0-9F0D6FE3C214" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Date: Wed, 18 Jan 2023 18:57:15 +0100 In-Reply-To: Cc: internals@lists.php.net To: Kamil Tekiela References: <04288995-54CE-41A4-BFFD-A7CF72F16D3F@gmail.com> X-Mailer: Apple Mail (2.3731.300.101.1.3) Subject: Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_A01A2FEE-2324-457E-87B0-9F0D6FE3C214 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 18 janv. 2023 =C3=A0 18:27, Kamil Tekiela a = =C3=A9crit : >=20 > Strings should not be incrementable unless they are numeric strings. = The > current "feature" is more like a bug from xkcd comic. = https://xkcd.com/1172/ >=20 > But as there is a real need for a similar functionality, for example = when > working with Excel, I would propose to add a class into the language = that > is able to calculate and iterate any bijective base system. It needs = to > have a clear functional spec and should support both = increment/decrement > operators as well as iterators. I see this as the only way out of this > mess. This RFC needs to pass, but it cannot pass without an = alternative for > people who actually use this "feature". For those that lack imagination about possible use cases, here is mine: = generating unique (in the scope of the request) alphabetic ids: function nextid(): string { static $id =3D 'zz'; return ++$id; } But no over-engineering please: no class and no decrement equivalent = (the latter could be added in a separate RFC if it is really deemed = useful), just a plain function that replicate the current behaviour for = strings of the form /^[A-Za-z0-9]*$/, minus the bugs around the peculiar = notion of =E2=80=9Cnumeric string=E2=80=9D (e.g., "9E1" equivalent to = 90). =E2=80=94Claude= --Apple-Mail=_A01A2FEE-2324-457E-87B0-9F0D6FE3C214--