Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97968 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83984 invoked from network); 26 Jan 2017 09:46:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2017 09:46:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.218 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.218 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.218] ([81.169.146.218:33713] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/61-04124-885C9885 for ; Thu, 26 Jan 2017 04:46:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1485424005; l=4791; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=vLr1EW/zSVwbz/FE91NZPDQbkL20N3vCzAaWyUjdkpI=; b=whyzbnN0O3WxwHZirN0jvOLLd60wOblmXi1rZCClktnuU/JsDCQjJcOS3XM/wMqktZ RdkIu8M55gAcfHmjhnN1QlIMihuCYeCp5JRwe9R8qzqBtkjZ253YwprRYOslctsRwgq0 pANw4oKnNGQpnlm5rpI9OFU5nwie3gPX83GM8= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNJBqD/ufY= X-RZG-CLASS-ID: mo00 Received: from mail-qt0-f179.google.com ([209.85.216.179]) by smtp.strato.de (RZmta 39.11 AUTH) with ESMTPSA id k07b72t0Q9kj2yu (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Thu, 26 Jan 2017 10:46:45 +0100 (CET) Received: by mail-qt0-f179.google.com with SMTP id k15so65238187qtg.3 for ; Thu, 26 Jan 2017 01:46:45 -0800 (PST) X-Gm-Message-State: AIkVDXLRreH0fo/Ne5K+MMP4R0RLKYBkaJv2APuiL64XZaA3gkWGvz9f1LCfxcVxAAbpt/VqNQNMZPxsdLnZXw== X-Received: by 10.233.237.136 with SMTP id c130mr1932730qkg.160.1485424004463; Thu, 26 Jan 2017 01:46:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.144.132 with HTTP; Thu, 26 Jan 2017 01:46:44 -0800 (PST) In-Reply-To: References: Date: Thu, 26 Jan 2017 10:46:44 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Rasmus Schultz Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c09830e209d1b0546fc3ab8 Subject: Re: [PHP-DEV] Not autoloading functions From: me@kelunik.com (Niklas Keller) --94eb2c09830e209d1b0546fc3ab8 Content-Type: text/plain; charset=UTF-8 > > Since the autoloading functions proposal is stalled, how about allowing for > import of static functions instead? > > use function Foo::bar; > > bar(); // calls Foo::bar() > > There are two benefits to this approach: > > 1. There is immediate support for autoloading without any need for adoption > or support in existing autoloaders. > It adds "support". Just use a static method then instead of inventing some new alias system. > 2. Pseudo-namespaces (abstract classes with stateless static functions) are > already widely practiced in PHP - a lot of existing code would be supported > as is. > That same code is already supported, no need for a language change here. > The syntax when calling functions would be the same. > > If we had function autoloading, we would likely collect related functions > in a file anyway - putting them in a class instead gives more less the same > exact result. > > The only drawback I can see, is the inability to import a whole set of > functions with one statement - but being explicit about external imports is > widely considered best practice for classes and interfaces, so why not for > functions. Just import the class and you're fine, you have just imported a group of functions. > Yeah, it's a bit inconvenient, but at least we can move ahead > and leverage existing code without changes or BC breaks. It's not all bad. > It's better than nothing perhaps? :-) > > Thoughts? > I don't see any benefits here, just drawbacks. It adds yet another alias system, function calls can now be function calls and static methods. What's with the static scope? It gets lost here. Nothing shows there's a static scope. Strong -1 from me, sorry. Regards, Niklas --94eb2c09830e209d1b0546fc3ab8--