Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97910 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92485 invoked from network); 21 Jan 2017 08:14:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2017 08:14:45 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.220.176 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.220.176 mail-qk0-f176.google.com Received: from [209.85.220.176] ([209.85.220.176:34933] helo=mail-qk0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/DC-00729-27813885 for ; Sat, 21 Jan 2017 03:14:45 -0500 Received: by mail-qk0-f176.google.com with SMTP id u25so33620387qki.2 for ; Sat, 21 Jan 2017 00:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zcQsGRxOONV2ObPHm8g2KVn9jN0FoHY7LQNLjP81JNc=; b=nr7OKz+tzORu2W/EgSVd6bAibgrdQqIfL7SOqI+FhCZYO7GEHIPbJscAjgFXI9LoGf OZowMol2CEO7lXhVMrLTVkbf1Oh6EyuFgj73t9wiaW6j1ev435RztTJ/9v+Frv+CRUJe McYRsxQYnCZ5O88kP4tSr8YU0uTkyk0LmZ+slBf6tGCdOxmiQey9cwKk1QMvSn/9RfqE F+R6GyuFFS/UyBLa7mIaiXCQgHi96bAK+gaf8gz/xYvehWfjxiOJrrgUBgoLkUQmp8MF 1E0WZl3Mq38dmrIRUnVMGCUuyeZaed2jsTswAWecPgJaOC2za4ARgwADPLZfuP6Qz9E/ RH8Q== 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=zcQsGRxOONV2ObPHm8g2KVn9jN0FoHY7LQNLjP81JNc=; b=uMoXgJZvLmIi9Jd4YRVpk0bJbukse4UleiWpJfl/YFrjnJV6stLC67IRl/9ByR45gp OUL0sQbPesGF319uPFem54y7lgzAJHy5CfC5q2tT5N0RrDsWH0SWpw/5eYCjBMvep1S/ t/HY65C1itUeTiW/z1yB23ktYnsh4rFseyLD3nBKGR1S320dHsu+3sZAF+zLZRTPZ8o5 GS2mrUyqDMtBYwkfSh4JS2V6kSmzSdMx+XQuInMIeb78WYQd4Keu5Jy2VczvRJuvpBxH xM3opfzMTT3NfjlJUg34WY/0HcD61aFQ9KhcFCfS1e0+Lq1Js4I11JXIQKLRLhIcl8A/ brFg== X-Gm-Message-State: AIkVDXIo2NoxZ0iLqOtu0FfSgJWhEAcwlrMsLKpGwNAPY/7FwdeOkhdJTuVomeIm0KiyQDFQ1e/QJP0S6apiVA== X-Received: by 10.55.42.41 with SMTP id q41mr16573808qkh.169.1484986479724; Sat, 21 Jan 2017 00:14:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.47.231 with HTTP; Sat, 21 Jan 2017 00:14:39 -0800 (PST) Received: by 10.237.47.231 with HTTP; Sat, 21 Jan 2017 00:14:39 -0800 (PST) In-Reply-To: References: Date: Sat, 21 Jan 2017 09:14:39 +0100 Message-ID: To: Stanislav Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1149389c9edfda0546965b13 Subject: Re: [PHP-DEV] Not autoloading functions From: rasmus@mindplay.dk (Rasmus Schultz) --001a1149389c9edfda0546965b13 Content-Type: text/plain; charset=UTF-8 > 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 for - 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 will 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 --001a1149389c9edfda0546965b13--