Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104664 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88569 invoked from network); 12 Mar 2019 12:05:08 -0000 Received: from unknown (HELO mail-oi1-f171.google.com) (209.85.167.171) by pb1.pair.com with SMTP; 12 Mar 2019 12:05:08 -0000 Received: by mail-oi1-f171.google.com with SMTP id u128so1442563oie.2 for ; Tue, 12 Mar 2019 01:54:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7S90s9o003L+8e1q8TCgWmH+s9n87AWmoQHCAqdkiCQ=; b=fd2s9B/P/iBW+crX5CWLpvh9Xkwaa0VzTvhrKoBBFb7bOBYktSiKk+MP10aygFrr1n coKoLnoeN1dl9mDqaYPoI31LuR9a3aHeQU07OsqmhVZNTwXwwf8DlnJOPRewotHB6rnN cngBQsZ7lyXKOmOXDi9f4s4udbLL5sP1kKCm9OWJTcJhevMf16mWOOtsZ9+j+Dl8PZ+9 gP61ixz1XIJqflgkxwrh/wA7AFYeIiXcm7e2LPYAoyk2czoo1oNzhRb21IfVLrTKkH7c Tro3dTdnwAqHWrFCdvMybHRaDKjGNr2cqVyiws1smHh7KzYX45ft7DGhYFnXAPQ6JTDi GXcQ== X-Gm-Message-State: APjAAAV4mP7cXsMLLpsdzMHsCMwQS4tabNHsbP87oa9xW/fm55eIdBQq kIPIaBfYqZkufC+Hdvoq2z0KdhQW8xaKY3F2Km9V5pcC2ks= X-Google-Smtp-Source: APXvYqxnoUTCsYP77q97j29wMqd2T0Z5MYy/VRtszW/00NNCA0ejsOCpKCyv18HvY5oASnskU9pAECXgE4+nxtb9n6c= X-Received: by 2002:aca:b5c1:: with SMTP id e184mr1040809oif.75.1552380898668; Tue, 12 Mar 2019 01:54:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 12 Mar 2019 10:54:47 +0200 Message-ID: To: Larry Garfield Cc: Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC Draft: Comprehensions From: kalle@php.net (Kalle Sommer Nielsen) Hi Den s=C3=B8n. 10. mar. 2019 kl. 23.45 skrev Larry Garfield : > > Hello, peoples. I know it's been discussed once or twice before on the l= ist, many years ago, but not recently. I therefore feel OK putting forth t= he following draft proposal for Comprehensions, aka "compact generators", i= n PHP: > > https://wiki.php.net/rfc/comprehensions While I think believe the RFC has great intentions, I am not a fan by any means to introduce convoluted syntaxes like this into PHP, I think it is rather hard to read vs the gain of saving a few key strokes. I think that both the shorthand closures and this makes PHP code potentially even harder to read and I would prefer we did not add such essential sugar where you need to understand the semantics very well to understand what a piece of foreign code may do, in what order (like the no yield example given). One more thing that kinda "annoys" me / what I base my above statement on is; when reading some of the example is that the code examples given, as in the code inside a Comprehension does not look very PHP-ish besides the $-sigil and I do not like the idea of having "two" syntaxes for PHP where one is only available in a very narrow-, specific context and I feel it would be prone to potential errors. Another thing that has been mentioned by multiple people now is the for-vs-foreach; If it is a foreach, which you mention in the RFC then it should be so, not for. A little background on where I am coming from here; I think it is great that we look at other languages and technologies when designing PHP and adding more features the language, however while I do believe it is an important point to keep cross language consistency, I do think that consistency with PHP itself is more important, which I believe too, is the reason for the expression for using foreach in this context comes from (not only from my PoV). --=20 regards, Kalle Sommer Nielsen kalle@php.net