Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105060 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23564 invoked from network); 3 Apr 2019 21:46:57 -0000 Received: from unknown (HELO mail-wr1-f54.google.com) (209.85.221.54) by pb1.pair.com with SMTP; 3 Apr 2019 21:46:57 -0000 Received: by mail-wr1-f54.google.com with SMTP id k11so192650wro.5 for ; Wed, 03 Apr 2019 11:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=QNN3Vrs1ntYeQkXChihpPIxkPAIc/4a53tS2/anHK7g=; b=Jtq4BZyAz5I62GSvl5rN7PbFdEBCSZfReBXC4MpsylWj2DhvzMniCrA/DrKHSkTti/ O0tXUmOzBC7PDE3ao+U/09B+ukU4xSlSY+2PcCSfhN636MTMJtLlt4mgklj65iMrh9i9 048qXH0wWcikE3YCvQ/rvEsa210EaLrcaOvu8BMZ1fmAJjxJblD7oFAa0L9iZooSFvcE vjDybYLjRA8svwu209DVoiKR/Q4ZZyU3lCQB8ytfrkJPHV3kmJj0GmWjbrvcvkYFNj9L YDtYdiNen6GK2Rg8AfzMrIlO09bb2pPzBax1nQ5QDFUcaMx9LcX53fi0tw/dnJKUqXIz ZPcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=QNN3Vrs1ntYeQkXChihpPIxkPAIc/4a53tS2/anHK7g=; b=pAoviduYumj6rGn9SKfH+PFaACoFBGtgUQsAnEt1AHC6D0WjCAFm008SJMunnYl0S0 QZfTjicPFjf3Sgn7iDWgj7mbyHpxqO4fJ6dJ5sBZoWRINKNrxS19Ww09gFAe1aej7LIi KNymTxtmhxcR5ngpdOLZwitmdFIkn7HN8nng8E645yIX2zv2pwAcR4PPrpUgfH6IVANj +l2NZe5AlVlk8T7hnlWMGcgg0e9k74q2LwoG4+7mCIqG4zxRpIsL3P1QV6dy0tjk1d0P Uw4GlvoQiBTTHgGYDS8uHFxcES4OpqD84Ha+m6OtkXLms3v1DOixc9VHrzsF2e3YAPOA UbnA== X-Gm-Message-State: APjAAAXp4xxJjqsPxtE3o0Ix9GJ70wndkrUn1hp0ted9Hs3aoLNdpUl+ lS9gGJkvqz6xwoTB7o8V/utLFWMA X-Google-Smtp-Source: APXvYqz9MxATVY8dB21dcDArqZ97im/ckICLCH5iy738HdGwUJOE0FySCUZGl6MjN2GsIB58DF2QFA== X-Received: by 2002:adf:e648:: with SMTP id b8mr791367wrn.132.1554316943866; Wed, 03 Apr 2019 11:42:23 -0700 (PDT) Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id w2sm13023620wrm.74.2019.04.03.11.42.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 11:42:22 -0700 (PDT) To: PHP internals References: <65AF9E1E-DFA6-47AE-952B-9ABEBD9B6038@gmail.com> Message-ID: <284d1f9f-03d3-1488-77dd-82e18edf9f4c@gmail.com> Date: Wed, 3 Apr 2019 19:42:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] Question about adding !function_identifier From: rowan.collins@gmail.com (Rowan Collins) On 03/04/2019 18:13, M. W. Moe wrote: > The argument sits there. > > function handle(int $cmd, ...$arg) : int /* throw */ > function !handle(int $cmd, ...$arg) : int The first example is unambiguous, easy to understand by anyone with a basic knowledge of the language, easy to spot when reading the code, easy to grep for, and will be recognised as a comment by any tool for parsing PHP. The second example is hard to spot, completely opaque in meaning, and would break any tool which didn't have it added as a feature. I'm really struggling to see any advantages at all, other than saving a few key presses. Of course, neither documents what type of exceptions will be thrown, so it's a bit like documenting every return type as either "void" or "mixed"; which is why the more common practice would look more like this: /** @throws InvalidFooException */ function handle(int $cmd, ...$arg): int > you seems not having the experience of working on the same code base > with basically literally dozen of people which can at > some point intervene; this is reality, this not wrong or bad; you deal > with it. You're right, I haven't worked in a team that size, but if I did, I would expect strict coding standards that emphasise clear intent and documented behaviour to be absolutely essential for everyone to know what was going on. > either you enforce extra qualifiers in term of signature or you don't > encourage it I'm struggling to see the difference between enforcing "add an ! before the name if it throws" and "add a comment next to the name if it throws", or even "add X to the name if it throws", unless the language itself is going to perform some extra check. Regards, -- Rowan Collins [IMSoP]