Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116219 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41633 invoked from network); 4 Oct 2021 18:31:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Oct 2021 18:31:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1822A180511 for ; Mon, 4 Oct 2021 12:15:32 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 4 Oct 2021 12:15:31 -0700 (PDT) Received: by mail-vs1-f48.google.com with SMTP id g10so3401037vsb.8 for ; Mon, 04 Oct 2021 12:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baumgart-pl.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3xJ2H9tE+ODlYAehFdaz3GJthrROrdcUwTcKJ4N3MDY=; b=mmcUPwbYh0bde2URroqWUaEtg61BnofeWFEmj9Uwj2bQDC1ODfTWyiGzy8nBJe+CQ9 KJpNhKNl7T64xXd1K1AHmEeyZRgvm++MIJ3JRa0rEjs83ik6Bd8+pzxJDWBQpJgf7HiG 4KjdLfVXEtPFpBjAYq/8MGWytd+waCqzwwaWwbM3t+urxSIo7aueIiOHVBCcGCwmcoY8 Y7N/S3MapW/8kWJsKhup+O/7rnW9UDPs/Vi7lmkAO6vqgemgkSVdvOGI94k7iFsSiWsM fjRBTC4at5jwLFsbwv+s3w9Zo/ERNx8cd2YTPWLbbYe+FOK97biTs+DJmp55gs+AdWyi NfRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3xJ2H9tE+ODlYAehFdaz3GJthrROrdcUwTcKJ4N3MDY=; b=DrG7VUeUWy8XUamn0tldMuYghJbq6qUpzgc+x3jr1SMuJZ/LeIDrWXIUBazsyn1xjn FiyrRJ6BDl5cT7g1gePfFroHcf8MGaeK6GnSj5RFcUE6DbgW5z9nS1MUlZhTbOLRh1Kj WBVg3Z/CMP9GvON3DltX1T2U/CT8UBl5U5MV2E3Bcix++DYNkqHwZKHwzwtQ6clKu7hh ZnnEzn+fDb8rndgNB+Ljrs0sGdSabkbsA9RKZcbAwdBgr1k5Xxn5RX9GPOLsBHLMx02L JjggJDHJK3qSXE6Uvs/zIAIj9vUAM/tr44YxB0UNoC0yuF/OW9vJrN0GHLTAXVZCGgvN hPig== X-Gm-Message-State: AOAM531qJBJKBIpKDgIWZEA2EpVOqZ/I1WbYVbEaUZluIX4sQWTykCkO iH0DHqD4n9vH5a0Zj7wkT9YJUc/ohwHTZ7JADzMLYw== X-Google-Smtp-Source: ABdhPJwTxuGPsUG5wsQcZeP0kYo9qsrL7wgE/tU4da82BHvFp1/0e31hkNGHs/hNQAV3SFzdXKtR5Nxki2L5Q93vOSw= X-Received: by 2002:a67:7382:: with SMTP id o124mr14941300vsc.54.1633374930395; Mon, 04 Oct 2021 12:15:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 4 Oct 2021 21:15:13 +0200 Message-ID: To: Lynn Cc: PHP internals , nikita.ppv@gmail.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Proposal: Shorthand initialization and destructuring of associative arrays From: konrad@baumgart.pl (Konrad Baumgart) > I have spare time this October, so I would happily get into php interpreter by developing this. Unfortunately my plans to have spare time FAILED and I'm not able to contribute in the near future. > If something like this were to be introduced, I'd happily see it happen with anonymous objects and interfaces accepting properties: Using classes/interfaces rather than associative arrays is superior in 'enterprise' projects, but sometimes I just want to quickly return tuple or construct json response. > This way php could verify the return value with the return type, and static analyzers can determine the structure of what's to be returned. Imo this functionality is not worth the headache with arrays. We recently got #[ArrayShape]. Maybe associative arrays will get more love from static analyzers and will be suitable for 'tuple returns'.