Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110101 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3708 invoked from network); 9 May 2020 19:30:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 May 2020 19:30:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 804FF1801FD for ; Sat, 9 May 2020 11:06:29 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS2639 136.143.188.0/24 X-Spam-Virus: No X-Envelope-From: Received: from sender4-op-o11.zoho.com (sender4-op-o11.zoho.com [136.143.188.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 9 May 2020 11:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589047585; cv=none; d=zohomail.com; s=zohoarc; b=RbXWDvfwohMxM8EQpztGXXOZQ/w1ghqguheSE12FpQNR/kNtSLUUYbxgrYNLLvykIMwFju6AVVqCMasMILgN+jVnHxD0iZs0ouY1n+vfDQgPdulm7jUikLMFzRYUggpWfPl45yJZDnJFnFm8V9wGgHZmhom8QIaHllPfQ7MUq0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589047585; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gzHKxkMh7YhXmfkDfsY0VlTtMLJFFFgn3eETgEi++ag=; b=JnGlEmcbEOkPbo4jvIug8KgCDCu7Jj2h5SqQqUhu+TXA/RtKkxosCFA86qva9C0Y3lymRu7zPTad0nZ5/lTscpSo7wI3nssnmh2HeB7yJ4bSg4i7EyU/fs0PaOGsd1OIBpxxtS/v1ow6/g1R2ZBg03u2hL3evPhENTpNemk7UnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=manuelcanga.dev; spf=pass smtp.mailfrom=php@manuelcanga.dev; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1589047585; s=zoho; d=manuelcanga.dev; i=php@manuelcanga.dev; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=gzHKxkMh7YhXmfkDfsY0VlTtMLJFFFgn3eETgEi++ag=; b=KV4ineR5FX/VrHpe+aNkBXZSW+VTa1TVORnyHjW/zWcgoEWJvmxV1gwn1atyZpFf J281+zk9HMbzIBaV71HTjSfInguP3KdEHY/QDV99jCfUBkGqPFoFSS4W5qzem6OjQtZ wT7Ra/SkwTfGiaeOfL7RiXrgEVvInK4Zpl+UXjJg= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 158904755303545.12349479058787; Sat, 9 May 2020 11:05:53 -0700 (PDT) Date: Sat, 09 May 2020 20:05:53 +0200 To: "Dan Ackroyd" Cc: "Rowan Tommins" , "internals" Message-ID: <171fa9d4340.12467d6d9609400.4331478987159209091@manuelcanga.dev> In-Reply-To: References: <171dee3baf3.bef5753260554.3262181919550021853@manuelcanga.dev> <171e05b4ced.1041f31b5124598.4028595156690203917@manuelcanga.dev> <10faa29f-f08f-a73e-b76d-683f5abbee86@gmail.com> <171f30b0df0.102b810be444185.2462173785894899100@manuelcanga.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Subject: Re: [PHP-DEV] [RFC] Keep type of reference params From: php@manuelcanga.dev (Manuel Canga) ---- En vie, 08 may 2020 15:07:13 +0200 Dan Ackroyd escribi=C3=B3 ---- > On Fri, 8 May 2020 at 07:49, Manuel Canga wrote: > > > > What is your opinion ? Do you see it useful ? >=20 > I can see the need; I strongly dislike the idea of using references for = this. >=20 > What you're describing is a form of 'out parameters' which have been > mentioned a few times before on this list. >=20 > I've made a note of the general idea here: > https://github.com/Danack/RfcCodex/blob/master/out_parameters.md >=20 > Though the wikipedia article is also good: > https://en.wikipedia.org/wiki/Parameter_(computer_programming)#Output_pa= rameters >=20 > Using references for things like this is a bad idea as references make > it hard to reason about code. In this specific case, having the > function mutate the existing variable is horrible. Hi, Dan,=20 I think nothing is bad practice. It depends of context.=20 Example: global variables, __set/__get, public properties and so on could b= e considered bad practices, however, they sometimes are useful. References could be a priori bad idea, but if you limit your their dangerou= sness, they will be less bad. >=20 > > If nobody objects to this RFC >=20 > While you categorically must do what you must, I don't think you will > get much benefit from raising this as an RFC until you find someone > who can and is willing to implement it. I agree :'( >=20 > Actually, just finding any core contributor who is willing to say that > they would back this idea might be a good idea. >=20 > And yes, phpinternals could still really do with an 'informal but only > to open to voters' feedback mechanism. Someone should do something > about that....wait I'm _someone_. And I have wiki permissions. >=20 > So here's a page for a non-binding 'indication of interest' poll: > https://wiki.php.net/indication_of_interest/keep_type_of_reference_param= s Thanks so much, Dan >=20 > If anyone disagrees with the text, either please suggest a change or > edit it if you have karma. =20 I'd add( but I don't have karma ): Add a new`inout` keyword( very similar to 'inout' of Hack ) in order to: - Check type of out is equal to type of param( like example of my first ema= il ).=20 - Avoid modifying caller variable value when the function throws an excepti= on. ( Thanks to Mathew for link to inout* of Hacker language ) - Allow explicit call-site pass-by-reference annotation. ( Thanks to Rowand= s for link** to Nikita's RFC ) =20 * https://docs.hhvm.com/hack/functions/inout-parameters ** https://wiki.php.net/rfc/explicit_send_by_ref > cheers > Dan > Ack Thanks again, Dan, Regards -- Manuel Canga