Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119729 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49445 invoked from network); 16 Mar 2023 22:06:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Mar 2023 22:06:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BBC81180552 for ; Thu, 16 Mar 2023 15:06:07 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 ; Thu, 16 Mar 2023 15:06:07 -0700 (PDT) Received: by mail-wm1-f46.google.com with SMTP id k25-20020a7bc419000000b003ed23114fa7so4049713wmi.4 for ; Thu, 16 Mar 2023 15:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679004366; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=a2klT4IEgPfol3OU4TjhaicQOi6H7SpllTuLKdiMiDQ=; b=gdkKEN94kwizI/4Qd5xB/Nw/yEd8Ej1p+WLAFBcuIxgrOPiJj5WfS1FWa6avNeuqTC RyyJzT7rXcMcWR4ibe0fhBnVVhbbXfJubTVidHhn845d+C7D084fq7pYV4aT1yrY9swb jMlsTElMtNpqHVrwyyNn7RfkHYIlqTlto6CIzwTSYNzpMjQw/WZRjTYmjXFL837+f6/V RF8mWGyNhhI/I02htlkmo+TGdK1QEUVy5zSVwcS/5r1pIRpTPVla/99povyId7XAYB7T ebkj/JjSfyGeamd9CT/J98Jr6bXiPrE9kiZUVpxNvgMuiKEfrrktDGPFEyotSpg+ftz2 CUgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679004366; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a2klT4IEgPfol3OU4TjhaicQOi6H7SpllTuLKdiMiDQ=; b=BVM+TBl4xEepHfcfhzCNxBvcgnDNDt6e+SSNuSmVjhDi6kLEkk6aLSL71eNT2t+7nU VuIg+s89vJDlq65X2Df1WnyL52EY79g4G51kx/FXuazp0003dZSTfgBHghnqjjMaKmXI pya6fBwkiiOz6o1GwnbCeVCUWdUiqwHwyv/6+LTV5/gTbKlDZ3NBGvud8aQR9cfInxuh HJyKMc3SKJmasikRKOY/H3QJEDqryq8WYkobh3q2lMYhmDVb6kG+YQXA9Dm2Isd0LW1c Mzre+9gFNYxgU98bpJoA6KOepNdg5lUGFHe+36xkbHKzQG/javYEd/TkKnFQ64OHwvdP EgtA== X-Gm-Message-State: AO0yUKX/JvlAVpURklIUFti1VaHzi4dPonXX6xOaTz5svL3IGGpzoQVP kyki2E6m3DIbGgv/qbZ4boUms86i2wg= X-Google-Smtp-Source: AK7set8lE5ZAtW4OdOA8pKtiHNALo3Fv88PYmvwAc1QSfBMW9/waR+nX6Qwkvi8YqurN8HGQY1LG/w== X-Received: by 2002:a05:600c:458f:b0:3eb:38e6:f650 with SMTP id r15-20020a05600c458f00b003eb38e6f650mr21448983wmo.41.1679004366015; Thu, 16 Mar 2023 15:06:06 -0700 (PDT) Received: from [192.168.0.22] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.googlemail.com with ESMTPSA id a3-20020a05600c224300b003eae73f0fc1sm254554wmm.18.2023.03.16.15.06.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Mar 2023 15:06:05 -0700 (PDT) Message-ID: Date: Thu, 16 Mar 2023 22:06:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-GB To: PHP Internals References: <8a9a04b3-45e6-47dd-dee8-0f524e49bd37@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables From: rowan.collins@gmail.com (Rowan Tommins) On 16/03/2023 17:59, Nicolas Grekas wrote: > We could define the "use" as declaring + setting the properties before > the constructor is called, if any. > But I'm also fine making both constructs conflict: when there is a > constructor, the boilerplate saved by the "use" becomes really low. > No strong opinion either. There could be other factors to consider. The main advantage of generating an actual constructor is that no change is needed to the shared object initialization code, which could be complex and even have performance impact. The only new logic would be in compiling the class entry and putting the arguments into the "new class(...)" statement. The more I think about it, the more I'm leaning to just blocking custom constructors, and saying you can either have the use() short-hand, or you can have custom initialization. Additional functionality can always be added in later if someone comes up with a clean implementation and a good use case. Regards, -- Rowan Tommins [IMSoP]