Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104814 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78008 invoked from network); 20 Mar 2019 03:36:58 -0000 Received: from unknown (HELO mail-oi1-f173.google.com) (209.85.167.173) by pb1.pair.com with SMTP; 20 Mar 2019 03:36:58 -0000 Received: by mail-oi1-f173.google.com with SMTP id i21so404664oib.11 for ; Tue, 19 Mar 2019 17:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=USozCoJdjMoqWwG6J7JuKESZOJfLxSZNKcbVG9yx+u4=; b=TVyIDV5nnqq7lwOsYmR10NlK6YBXoeDkYqNWSH87u8RpYX9Og5G6ofCZ3BIhYzpWbc a5BBaS7KhUmkkzu4pMaxZnkg6+b+xpaH236ZH8kQBUDH6fefIvwCApFzVZV6kahKdymh ZlAnueDAm+U6aCsM7PoBAv3e6U7wxyOF8Zay3tJApaz4k6LuHWZDxn5VSuOS/tL41nFF 7z16CA46sghnzRJQhtqZUFQ/zdIK7vMYdixBqgNmGjbqirsrBapHZgjOUzKtAf9CIcqc ywvq2Vl5orgSIhkQSHuCw8LBEFOWq6jOv9LA76Qdl5XZtYQ7BUVbWcIeG/8jYmneqg5u nodg== 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=USozCoJdjMoqWwG6J7JuKESZOJfLxSZNKcbVG9yx+u4=; b=NadQTy+5EzRp29hWUJOUzLZBdz0NR9qZaWj3kBGSOTJYhPcoldjqK6/3fkIP7aAfWi aHNDhViC3qDLDezAPJuwYNcbrhpXZXAW/cfmNKI/dfQPb2Z65I2IevPXl1hJM/KoBr1y hOG7Ze1qFxWUGhi40Rs9ZkSj1p6Jmdh7vmdhFQyxpXQik7ie8w93lXUAKGKBRfx2NLyz AlNoIgHg6T+q3Z6MS/5YRAq99viH3+X2ICN9viIyZWrGnYOz/LoH3NkW6jzi4y//10KB Zl53pmdkkK23ToQNdMxOlmI3+ssUYnm/O+jDPkGjG9U+0bDApdpavpplCuwlOUShBMYV ox4g== X-Gm-Message-State: APjAAAXGEdx0dS+HkuEQPtmVb092KUt05YGAxo8tyn0HpMQEP48BjcHT umkkcZIFyqtp3wxS/Hb/Af/c8fWQBWcT7AueXMrzfw== X-Google-Smtp-Source: APXvYqyalYGlxEWHLH1P1y8WRuJI+hagAxbeMtHxfXYs7IyJLdRISeXw9OLxkDIt6F5sC1hXJPbgKjvFvXzW5tZFAtQ= X-Received: by 2002:aca:f44f:: with SMTP id s76mr3465035oih.81.1553041723490; Tue, 19 Mar 2019 17:28:43 -0700 (PDT) MIME-Version: 1.0 References: <85417a73-a391-c9ad-49aa-5b88c65b0900@gmail.com> <5c8ea43d.1c69fb81.e50f1.7d18SMTPIN_ADDED_MISSING@mx.google.com> <0d34b3b1-866e-4bab-9a8f-3c70f1fc9721@www.fastmail.com> In-Reply-To: <0d34b3b1-866e-4bab-9a8f-3c70f1fc9721@www.fastmail.com> Date: Wed, 20 Mar 2019 00:28:31 +0000 Message-ID: To: Larry Garfield Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] RFC Draft: Comprehensions From: robehickman@gmail.com (Robert Hickman) > > In python comprehensions on [] makes a list and comprehensions in {} > > make a dictionary (list and dict comprehensions). As PHP only has one > > 'array' type using [] makes sense. Along that train of thought, should > > comprehensions also be possible in the old array() syntax? > > Honestly, I cannot think of any case where I'd use a comprehension where = I would definitely want an array and not a generator. In the majority case= both work equally well, cool, but I don't know when I would even use an ar= ray-dependent version. And converting from a generator to an array is triv= ial; the other way, very not so much. > Would there be any notable performance difference? I'd expect the case where one actually wanted the whole array to be slower if it was going through a generator, vs a tight loop, due to the additional level of indirection.