Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105058 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3811 invoked from network); 3 Apr 2019 20:29:04 -0000 Received: from unknown (HELO mail-io1-f42.google.com) (209.85.166.42) by pb1.pair.com with SMTP; 3 Apr 2019 20:29:04 -0000 Received: by mail-io1-f42.google.com with SMTP id v4so14753985ioj.5 for ; Wed, 03 Apr 2019 10:24:30 -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; bh=klD7j/viCmG166F2Qd9QVNFgE5AGY+YY0IeJBclhNqM=; b=ua4wyzyi50osEd+8FZD+bVWqufStd3s2Js+KBQ06Se9G6tUngqTW3HtK8Eiyhfm6B+ i3MC1XOG0og0kp8A/wscrHqTGfKaXRqGpkFR7vMJDBC/sDmrrKXRguE8VwIrJQVs3ScX zXHWYTa1Mu2JpirHVVATvWjQf1h2E7dsL8y549IT2AzZEc1ousMY5sMsmc0utBck++4G DyvIvHoVy+cJzza95WOnHxksJjy/J1LMsxTKon8ZxAJDfvjIc42RSFd6cG0WHJSakg8E wDS5YVDcV0hwqs4oIg/KedNWRnF77PYfmwwi8cHKgeIPqxwuUXFl0pf+HvpSqtLAaJCD k/gA== 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; bh=klD7j/viCmG166F2Qd9QVNFgE5AGY+YY0IeJBclhNqM=; b=NX8d9qOtcu7weaQ3QSGvk2C2xBMIVpmmDgRiAaQDsKe7odOw8W/unazudFmzRlme5m c50XbOf5fxLJByxCxXHU10tWfMeRYcs+qxWxP/tPdZEb6G9iV5h3UEZWOerxLDa1O+aV mpcLpfauxs4OkotU2HZdRuWmAPu/pvs3gKWbrkgHz06l6xOu1Co0q2Rx+Cv9gpznYkpR FI3BfCXK/fZtoD7/yvLKXwx/qTHRnHyO/r/Nr9sWy65P8QrLb+AeueDUT7B5nV4INDA9 xTS99VlysP3MSW1oWSpwQKq8I+o20rJCnJVv1jJDD7tLUF46fpMaNSv2+4XiQNX9942Z e1mQ== X-Gm-Message-State: APjAAAUfAQ8LnvYrc5Zbp4HP6nPL9ne4GbCBsRVTc5caX4+DXGwTHStT G6Gb6YecSyCpn0q1Vt7N0fGl2Rv4eyvfGOWjBUqPsqEl X-Google-Smtp-Source: APXvYqwOweGy961OvTguQinxhdwtd6dcnflYR2rrgVwrLJeL6aD8z/OxaS/XlWf4EJy+KM7go9YDRGva2WIy7PavFXo= X-Received: by 2002:a6b:5006:: with SMTP id e6mr943558iob.176.1554312270158; Wed, 03 Apr 2019 10:24:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 3 Apr 2019 18:24:18 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000bba1370585a3867d" Subject: Re: [PHP-DEV] Question about adding !function_identifier From: rowan.collins@gmail.com (Rowan Collins) --000000000000bba1370585a3867d Content-Type: text/plain; charset="UTF-8" On Wed, 3 Apr 2019 at 17:52, M. W. Moe wrote: > not documenting at first is not really a question of laziness or so, as > things are still moving around > you absolutely need this agility; a good design layout between theory and > stable state will refactored > discussed a thousand times; that what I expect from engineers; filling the > gaps between assumptions > and reality. > I think we have different assumptions about what "documentation" means here. I'm not saying you have to write a 500-word paragraph explaining the theory and edge-cases in the code; just that you should write a quick comment saying what the function expects, and what it will return, beyond the ability of the language's syntax. You *could* write every function like this: function tbc(...$args) { } That way, you can change the visibility, the argument types, the return types, and the name, without "documenting" it in advance. Clearly, that would be ridiculous, so you probably actually write this: public function convertFooToBar(Foo $foo): Bar { } What I mean by "documentation first" is to go a small step further and write: /** * Convert using the lookup tables * * @param Foo $foo Should only be given pre-validated Foo * @return Bar Will always be pre-validated * @throws InvalidFooTypeException */ public function convertFooToBar(Foo $foo): Bar { } This is all part of the *current* design of this function. It might change, but if it changes, you change the docblock, just as you'd change the signature if you realised it should actually be private, or accept a PreValidatedFoo object, or the name is wrong. You seem to want to do this same job, but with as few characters as possible, and I don't really understand why, if your aim is to be explicit and clear. If you just want to type less, use an IDE or editor with good auto-complete support. Regards, -- Rowan Collins [IMSoP] --000000000000bba1370585a3867d--