Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106839 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60986 invoked from network); 4 Sep 2019 02:35:46 -0000 Received: from unknown (HELO out3-smtp.messagingengine.com) (66.111.4.27) by pb1.pair.com with SMTP; 4 Sep 2019 02:35:46 -0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 1BF0E22274 for ; Tue, 3 Sep 2019 20:09:32 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Tue, 03 Sep 2019 20:09:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=eQ1UoF cgXbWoFpEsbImuSo1NKaoP8Y58UsnSPxXtAYg=; b=ZcSrIQgiiiALK3LO91cpRB pto7GH1rxebo/j+37VEDlcn2pgt9Duo6hOnJpc/cYCm0fvJJNNhnsRD4wlAM7FCt kMw8SQbJuK+x93V/BoX7z1O1dUMklD2BVK2yFFih+uNBP4YVNXnHeHRuUeXgTF6h 93cHB7mzbCPvt9YELNI0EH9QyAMG5qumHBfWOPeQ4KB9l+135ty4i2HMemwCzSeV B9koyP09oSiSYNNRC0BZt9hdGEdMvuBk/zEUj97j2UERhDG8g548J1lnREj3iQai I+fpMk1jku4iXkc/r5j5LeLGBNHEW9Yyk3EzIsGBhtCTTEiVqIiKy2qcNt6VnvcQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudejgedgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgv tghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id C333C14200A1; Tue, 3 Sep 2019 20:09:31 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-154-gfa7592a-fmstable-20190829v1 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Tue, 03 Sep 2019 19:09:11 -0500 To: "Steffen via internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Mixed mode methods From: larry@garfieldtech.com ("Larry Garfield") On Mon, Sep 2, 2019, at 1:03 PM, Andreas Hennings wrote: > The value of parameter-based polymorphism is for cases where the > calling code wants to handle all parameter types in one call, whereas > the callee has different implementations for different parameter > types. > > This is not the case here: The calling code does always know whether a > call should be static or not, so it can choose the applicable method > name. This is what I don't get. How can it not? If a method is static-safe, and you want to call it from both static and object contexts... Make it a static method and call it statically from both contexts. That's fine. If it's not safe to call from a static context (because it reads $this), you couldn't call it statically anyway. If the method has 2 different logic paths, depending on if it's a static or object context, then it should be two different methods. Folding them into one just pushes more conditionals down deeper into the code where the cyclomatic complexity impact is greater. That's not a win. --Larry Garfield