Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106293 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81721 invoked from network); 25 Jul 2019 15:37:39 -0000 Received: from unknown (HELO mail-vs1-f50.google.com) (209.85.217.50) by pb1.pair.com with SMTP; 25 Jul 2019 15:37:39 -0000 Received: by mail-vs1-f50.google.com with SMTP id 2so33605733vso.8 for ; Thu, 25 Jul 2019 06:01:18 -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; bh=zSKH4VeD9WDEj3vi3O4Zo44M9loijf7+7wmrNbvrQpg=; b=gigD2F5feKNxxfj1Py3gzpysrVZsPf6qPkBLZ0ZRpLDSSiR3QlNDipSBB2rxScUBmH nkck80p/2LCP5G0IRzXm6Z4l1KIr74xWlzY/79NNkz0ikL0zgbXqNGQCZuIcSRrw9Z8v 38dxQv/mqFeTNkweGkpEgQxN8sP3o5q/q3zyFmZE0PZf5d+f3iL8+QX3587nDKQdtMP/ dw9Ajhdtx+juIFszQBrBnlAHJQ7MyzPJ4Plzw+ftI3Z6uzc7Y3uBXV3I9ay449lEo6d7 5RB5NaqOjSlvJABY3JaI+wYm86qshi6ByMz419H/vzMHhdvWLU84Zc1PRT4MPWrlE5JN WUBA== 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; bh=zSKH4VeD9WDEj3vi3O4Zo44M9loijf7+7wmrNbvrQpg=; b=IWERqUJZypgqElrceicSpNFTEzFckcKc9aezaw0ieOsrtUUm8TEeTXO/sVJ390ZYnd xFnHiF4gc+7CKLc0gIOuLkS+k8hexTHwME/aKJhbEVXpe2o+AAhUBV0Zm0n4ukpDJVo+ oze6Zm1R982xPbpHcITMl5oTCLdws6sbHr/sbadWHFcP00yckII/gOhsAB5+74HLiCxl kHEI0hV2Hf8XjF00ThM9FWfnXkYeLmU2frCA/4bQi3Xd7eeJlTAOJ351vM4WvgEE8ilT gn9MSHvxIxfIV/KAGwJeuTcZBNGpUx37/JGO+0cgzbv2Yuv4QX7acEPcfHR/nHM9J5Xf l2jQ== X-Gm-Message-State: APjAAAWT6k03pvAx3X1XrzYQYp8GU2J5hi0JT2ILmZ7yHMXq9DToUkcZ 2dMXoFRuk2+hGzSQugSI1e0qYHnu2TCyMveErv3dG1bQ X-Google-Smtp-Source: APXvYqwUTM39Rzi3e5J4twk2uaub7A1Wo8w9IIjrGBp3toLC1ovnrDW0sN5BVAMsAlXvFKQTAinWQQ6avL7Drqci/dY= X-Received: by 2002:a67:e355:: with SMTP id s21mr55837953vsm.12.1564059678312; Thu, 25 Jul 2019 06:01:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 25 Jul 2019 15:01:05 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000888f2f058e8105c6" Subject: Re: [PHP-DEV] Re: [RFC] Explicit call-site send-by-ref syntax From: george.banyard@gmail.com ("G. P. B.") --000000000000888f2f058e8105c6 Content-Type: text/plain; charset="UTF-8" On Thu, 25 Jul 2019 at 14:32, Nikita Popov wrote: > On Wed, Dec 6, 2017 at 8:49 PM Nikita Popov wrote: > > > Hi internals, > > > > I'd like propose optional support for explicitly marking by-reference > > argument passing at the call-site, in addition to the declaration-site: > > > > https://wiki.php.net/rfc/explicit_send_by_ref > > > > In short, while currently we have > > > > function byRef(&$ref) {...} > > byRef($var); > > > > this proposal would also allow > > > > function byRef(&$ref) {...} > > byRef(&$var); > > > > so that the use of by-reference passing is obvious without having to > > consult the function declaration. > > > > Regards, > > Nikita > > > > I've rebased and finished the implementation for this and would like to > move forward with this RFC. > > I think it can either go forward as-is, in that it constitutes the first > step towards bringing sanity to by-reference passing in the long term. Or I > could first try to push through > https://wiki.php.net/rfc/namespace_scoped_declares or some variant thereof > so that call-site reference passing annotations can be made required on a > per-library/project basis. > > As most of the feedback here has been on whether this is really worthwhile > if it's only optional, I guess the second option would be preferred? > > Nikita > I think this can go as-is and a namespace scoped declare (or something similar) could always be added after the fact to make it required to use via a declare statement. Small semi-related tangent but maybe in conjunction to the strict comparison RFC and making it mandatory to use '&' at the call site via some way, we could have some "meta" declare statement which automatically would enable strict types, mark reference at call site and the strict comparison. Just an idea which I'm not sure is that wise. Best regards George P. Banyard --000000000000888f2f058e8105c6--