Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97914 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13415 invoked from network); 21 Jan 2017 14:53:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2017 14:53:48 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.176 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.161.176 mail-yw0-f176.google.com Received: from [209.85.161.176] ([209.85.161.176:33300] helo=mail-yw0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/1F-00729-BF573885 for ; Sat, 21 Jan 2017 09:53:48 -0500 Received: by mail-yw0-f176.google.com with SMTP id u68so73507174ywg.0 for ; Sat, 21 Jan 2017 06:53:47 -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 :cc; bh=qYV5avx3ELpgr6Now80Td02x0rElKj/i7nKuaU8X3+E=; b=HE2g2pitGtgfyP4v0eN3boFwgPvEM33yKCzyg99LdkxvVvrFk/2kcklWRXoEBinJkK cw6BtPwr3gVZPY0kZPk2Xn1tldY/T3X2XgXZ6k1iwwdo6KIRGeK+OrytReG8aT3Ok8yE lH+RhHMs4rS7i88PYjzaOVgR4AP4YcqkDCa/1+1T98vRmUWPZd55VBJ021ZmUcrHAtOL rvkWDAyCXr8wzXCqQ1mv/UP3dk282gt76ROgtf5pptvdM5eEsOfPhwrmuaAgHm1B6ndB SpGjIlrbUyxwskogUpndSVJimEhTqqcJYfbFLg8x0sVeTbJ1pUON7Yl21TbeiMfV5RBB l8iw== 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:cc; bh=qYV5avx3ELpgr6Now80Td02x0rElKj/i7nKuaU8X3+E=; b=F897prKgoFPJ+ZXMS0ksTQCyensQHvZrdMEN+jjq17o5w/mvmr3xuw6RbYvsQoFnap k4bDSzxG2MmQnjQVFVYSmtTODiOYultpibo3qQ5fl7iFRsrIdtnDKewGDdlciDAQp8hs BmXpziGPyOWPw0yFltYgf2r5J7zPIy8FRsnSNYd4H2VP0mGfxSGsURCWxj5jjN8Z4RE0 hksHr3bd9xNz8wlLtB5eIu3whwCGvJ0EirYdkRDVnk2Qy/WuWFb0pY6PEBh2N0DdCyMi sCer8t1+4YoWXXqOGac/hbwdq4dGFps+dxoJpItexDq1N0urJ58tgJOlHcg8YKVQ4RM2 Rnsw== X-Gm-Message-State: AIkVDXJsvf8FbW7pOd5SUGxogQTe8ALUAW7DA3ukmDjZ1PdXet226gErtH6Gcr+W+Mo8UWc+Faj9yOevKPpgag== X-Received: by 10.129.129.198 with SMTP id r189mr15746411ywf.0.1485010425579; Sat, 21 Jan 2017 06:53:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.176.168 with HTTP; Sat, 21 Jan 2017 06:53:25 -0800 (PST) In-Reply-To: References: Date: Sat, 21 Jan 2017 10:53:25 -0400 Message-ID: To: Rasmus Schultz Cc: Stanislav Malyshev , PHP internals Content-Type: multipart/alternative; boundary=94eb2c0812f2e78dbd05469bee7f Subject: Re: [PHP-DEV] Not autoloading functions From: marcio.web2@gmail.com (Marcio Almada) --94eb2c0812f2e78dbd05469bee7f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, Rasmus! 2017-01-21 4:14 GMT-04:00 Rasmus Schultz : > > How hard is it to write Foo::bar? You never have to go more > than one level. I don't see a point in mixing internal function > namespace with class methods for the sake of saving typing couple of > characters. > > I'm not suggesting we mix namespaces - this of course would be file-local= , > same as use-statements in general. > > You likely have to write a use-statement either way, if you're going to > call a static function, e.g.: > > use Foo\Bar\HtmlHelper; > echo HtmlHelper::escape($text); > > Versus: > > use Foo\Bar\HtmlHelper::escape; > echo escape($text); > > It's not about "saving characters", that's not what use-statements are fo= r > - it's to avoid qualifying the same references repeatedly, which (for one= ) > is better for source-control, whether that's a namespace or a class-name > being repeated. > > Anyhow, it sounds like most of you are positive about this idea, so I wil= l > ponder the details and post a small RFC :-) > > > On Jan 20, 2017 19:55, "Stanislav Malyshev" wrote: > > Hi! > > > Since the autoloading functions proposal is stalled, how about allowing > for > > import of static functions instead? > > > > use function Foo::bar; > > > > bar(); // calls Foo::bar() > > I'm not sure why it is good. This would certainly be confusing, if you > call strlen and turns out it's completely different function from what > you thought. One thing when it's the same namespace, at least you can be > aware what this package does, but if it's just an arbitrary function > from anywhere, it's really bad for understanding the code. > > How hard is it to write Foo::bar? You never have to go more > than one level. I don't see a point in mixing internal function > namespace with class methods for the sake of saving typing couple of > characters. > > -- > Stas Malyshev > smalyshev@gmail.com > I think this idea looks like the easiest way to avoid fixing the underlying problem. But it would irrevocably push functions to a "second class citizenship" of the language, in favor of static classes. It also would blurry the lines between namespaces and classes in a way we haven't seen before. Even though it feels pragmatic to do so, I'd prefer the harder path or at least wait for the next major until commit to this. Thanks, M=C3=A1rcio. --94eb2c0812f2e78dbd05469bee7f--