Re: Make require*/include* behave like a function for returning values, and more

From: Date: Tue, 17 Apr 2012 19:36:57 +0000
Subject: Re: Make require*/include* behave like a function for returning values, and more
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-60102@lists.php.net to get a copy of this message
Hi Paul, On 17/04/12 15:31, Paul Dragoonis wrote:
I don't see any fundamental benefit to having this in PHP. Unexposed symbols can be interesting when instrumended code (for my concerns) or simply for security and safety reasons. So, benefits exist.
It doesn't work around any current restrictions in the language. What do you mean?
It just looks like extra fluffy magic that we could do without. No extra magic stuffs, just new interesting features. Allowing (require 'file.php')['foo'] or (require 'file.php')('foo') is consistent with the fact that a file can return an array or a function. And yes, it's kind of syntax sugar from a certain point of view but it could improve PHP experience without adding any magic stuff. It's just more consistent.
No? Cheers. -- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://lifc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/

« previous php.internals (#60102) next »