Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97977 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24844 invoked from network); 26 Jan 2017 21:37:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2017 21:37:06 -0000 Authentication-Results: pb1.pair.com header.from=walterp@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=walterp@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.179 as permitted sender) X-PHP-List-Original-Sender: walterp@gmail.com X-Host-Fingerprint: 209.85.216.179 mail-qt0-f179.google.com Received: from [209.85.216.179] ([209.85.216.179:33625] helo=mail-qt0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/53-28703-00C6A885 for ; Thu, 26 Jan 2017 16:37:05 -0500 Received: by mail-qt0-f179.google.com with SMTP id v23so99069168qtb.0 for ; Thu, 26 Jan 2017 13:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=eQwv7UeLjbkzBcutkEglycxB7rxdpJBPjoaZtrITeFs=; b=OjITTh/Q+izYXY1/61iJ5k0NX4mrWx+9Kr6h25AtVnYo662c12SOQL7Y05u+bcm2EK uH6RdOaP9H+jkVNmXFb3KhLWMtayfNhwqznU0Fs/MOGw3hFhVPfcGdm6P/9brTU776by eQGpx0ay6KHRpSUeKEVGRzLm2Fk5AwRpOk/HFvP0gd407hC9Kn/DKFGR23lNFkWa2mq2 EZzro9jTnJOih0QWIGR0yzP820/+OP8kmJd/d/Vk3B5lA8V0yH5PoA1OQiXaOR4MXh+N 1hnbpLCKTVmIZiThsKooaL2JRxOQKKrVres8IfIB/q9O5hVASPq8XPcJszC8s3kH01l4 Eiug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=eQwv7UeLjbkzBcutkEglycxB7rxdpJBPjoaZtrITeFs=; b=pqVirrD6i7AkLBER11dl6i6CID761FbIfJHELVqv1ouYzs3vRSDUnHFyxejO9q/M6j TLgqjToiSEun3F3O6s9CgSp9n9KeVqIa3AqPxV44I42H+ocfJm/xfrnx2b6TYKYWy6Yj wi0QQuakTFP/9o0lMNWtTa6xpPeV4Nnk9lckkgDMNmQQRa99Z6p21HWYV0eMIyy8TMYk Dn56N3/QI3YTtmsdVO94vcIRJ3K+HpZ4t2i+pJz48aTJ+BvUiDstz/Cg/tEo9QWkg7Rm OGebjgV9qiKcTmzmIYNuz+NJ+B/ZsfL18XMDLegFuwC6RvXo9tdu6IXQOHb+51QNgY7q lkMQ== X-Gm-Message-State: AIkVDXIUKbyN+0jFss0DzF6nklnJS/KtvsOwuikrhuain8XcYT5MB2piMlSOEwpXLVz+iWseHFNZ1VGtuAL+7g== X-Received: by 10.55.220.199 with SMTP id v190mr5013188qki.42.1485466621362; Thu, 26 Jan 2017 13:37:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.162.33 with HTTP; Thu, 26 Jan 2017 13:37:00 -0800 (PST) In-Reply-To: References: <24.D0.04124.AABB9885@pb1.pair.com> Date: Thu, 26 Jan 2017 13:37:00 -0800 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=94eb2c0cc8584aca6f054706265a Subject: Re: [PHP-DEV] Re: Not autoloading functions From: walterp@gmail.com (Walter Parker) --94eb2c0cc8584aca6f054706265a Content-Type: text/plain; charset=UTF-8 On Thu, Jan 26, 2017 at 12:23 PM, Rasmus Schultz wrote: > > if you choose to use static methods instead of functions > > It's not a choice - functions are practically useless in a Composer > context, and most everything PHP is now Composer packages. > > Why are functions useless when using Composer? Is it because functions can't be autoloaded? Is this about getting functions to load without having to stick them in classes that can be autoloaded? > > why do you need this special syntax for calling them then? > > Yeah, but the same logic applies to namespaces and classes: > > If you choose to use namespaces, why do you need aliases for classes? > > Strictly speaking, you don't - but it would be really ugly and > inconvenient. Forcing you to qualify a namespace or the parent class of a > function repeatedly is just noise, same as qualifying the namespace before > every class or interface-reference. > > Agreed, it has no functional value, but neither does namespace-aliasing. > > Both have a considerable organizational benefit though: the ability to list > all your class, interface and function imports at the top of a file. > > To me, that's valuable. > > Either way, guys, here's a preliminary RFC: > > https://wiki.php.net/rfc/use-static-function > > While trying to describe this, I have to say, this doesn't appear to be the > slam-dunk it seemed to be - you can read the details on that page, but > given the two alternative approaches described on this page, it seems this > feature is likely to create just as many problems and WTF as the > auto-loading RFC. > > I'm afraid one isn't much better or worse than the other in that sense > really... > > Oh well :-/ > > > On Thu, Jan 26, 2017 at 6:50 PM, Niklas Keller wrote: > > > > The problem with stop-gap measures is they become entrenched, and the > >> proper solution doesn't get implemented > >> > >> This would be my general point of view - unfortunately, functions are > >> essentially useless at present, in a world with Composer, unless you're > >> willing to preload all functions from all packages up-front. > >> > >> The only suggested solutions I've heard for the name resolution issue > with > >> function autoloading frankly are all horrible - much worse than this > >> simple > >> alternative. > >> > >> Add to that the fact that likely 90% of all functions in the wild (at > >> least > >> in Composer packages) are currently implemented as public static > >> functions, > >> and in my opinion, this is starting to sound less like a stop-gap and > more > >> like a simple solution to a problem we've been solving with a stop-gap > >> for, > >> oh, 10 years or so... > > > > > > Again, if you choose to use static methods instead of functions, why do > > you need this special syntax for calling them then? > > > > Regards, Niklas > > > -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis --94eb2c0cc8584aca6f054706265a--