Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106334 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95661 invoked from network); 30 Jul 2019 08:49:33 -0000 Received: from unknown (HELO mail-ot1-f42.google.com) (209.85.210.42) by pb1.pair.com with SMTP; 30 Jul 2019 08:49:33 -0000 Received: by mail-ot1-f42.google.com with SMTP id b7so14944931otl.11 for ; Mon, 29 Jul 2019 23:14:22 -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=7PL7dAuVO41JxX90ygI8cO4CJ7gT34Q+60Zu/R/GN/o=; b=oyC/FJLQEmZo0enwsGkPzdUnQ3DgKYa95KNv+WWE5n3jzThb2V4x3yU9Ig1AebdToR O0CVSFd4X4Wh/JZ0jrR34cysxHJq1j/s4bJmhHuRAl37Unh5kJMzgpt4wgI5xSG9duRf rlt2vFU5MfLZn01cuinRWYy5Nro2w+Am9ddjg2hdI6Up+v3WKcluKuSmRc8Gs96GtDgB kyvLZmBDBg6gktzs2t2tDtTbqqg7xsv1R1ywAsi+apT3tf2Ovm3EfSQeLHEtsWes3WxE Ufleo2YfwoBSbcQmdVRo/aHxJmC+ZSO5EbeRiB0UFMB61EQ8Ufr2+lnWIhm7i1lRBKp6 mFhg== 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=7PL7dAuVO41JxX90ygI8cO4CJ7gT34Q+60Zu/R/GN/o=; b=JR4L4a2933B6cndWcDfbjmALrzrZweyJW17fR+RMLV98buZf+dFai7bkVTIDEqpVkI 3spnJu7h0MnU0LxxLBtfEyYL0MvdbHO3qmv2RLMLGIZhJ+FsgCiFMwRqsaoYfJGLR/z6 qP8HKluTVs6v2guVKjG/BabDLlVouxqhsR53NgKFYZxXFeWpeYVqNYNSmuzminMmf99q K8FuNraDigP9gu4mtMmBXCrx4tBJ7ZH/8KXYiZjzHmnLVQi+/NRcPKpwyTpyTfQ74soq g+V0YREDI9o6UTffFh37onm5Jmx5pQEbnpqe5dpZAIk9iY2O1CpIJ1BUUBqdhv+Z8iIQ 2x7Q== X-Gm-Message-State: APjAAAXmLb5K6F940LzCtheV7ICx9PUOZxWEBcBl85LfIrgG4b9Dwg/k vnTtILmsMOP2fNcMULF7VLSivelxCX6xAaVrQorP7Q== X-Google-Smtp-Source: APXvYqwxzPm+kcsTkv35njJyxd8pT7SgCSkyvM4d0UWcmUTY5hYIbNldX9/WXqjAJVdKPrr+sDkloimdd2JM3Vl/ypY= X-Received: by 2002:a05:6830:157:: with SMTP id j23mr61710717otp.198.1564467262356; Mon, 29 Jul 2019 23:14:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 30 Jul 2019 08:14:11 +0200 Message-ID: To: Nikita Popov Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000006f8159058edfeb4e" Subject: Re: [PHP-DEV] [RFC] Explicit call-site send-by-ref syntax From: nicolas.grekas@gmail.com (Nicolas Grekas) --0000000000006f8159058edfeb4e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le mer. 6 d=C3=A9c. 2017 =C3=A0 20:50, Nikita Popov = a =C3=A9crit : > 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. > I fully support this RFC. I've been caught many times forgetting about the fact some argument was modified by reference. Putting this information on the call side would definitely make code faster to decipher. References are part of the language. The fact that some think they should be avoided is orthogonal to the proposal. It's good to improve them. Also I think enough time has passed since php4's call-by-ref for the syntax to be reused now. I think it's unfair to call the RFC a reminiscent of call-by-ref BTW. About requiring such call-annotations using a "declare" directive it feels like a heated topic. But we don't need it, so let's split it appart. I could very well see userland tools enforce it at the CS-checking level. That would provide 99.999% of the target benefit while saving us some mental health issues and some unneeded technical challenges to solve. My 2 cts, Nicolas --0000000000006f8159058edfeb4e--