"Rowan Collins" wrote in message
news:ae15f883-bdba-89ea-9e6a-6e3b09745...@gmail.com...
On 29/01/2017 15:37, Wes wrote:
Curious that those who are posting here put all functions in the same
file.
So, why don't you just require_once('Namespace/functions.php') ?
By that argument, why not just
"Wes" wrote in message
news:CAOv67gtxm0muzuKrQyizgkM9Pf0hn7E-iTBXpq1VV9D8aUWM=w...@mail.gmail.com...
Curious that those who are posting here put all functions in the same file.
So, why don't you just require_once('Namespace/functions.php') ?
I do, but without using namespaces.
I actually gro
On 29/01/2017 17:56, Wes wrote:
Hi Rowan, I probably wasn't clear enough. How is having to write
use namespace Foo\Bar\Baz;
better than
require_once("../Foo/Bar/Baz/functions.php");
OK, your last question just mentioned putting multiple functions in one
file, not that you were addressing that
Hi Rowan, I probably wasn't clear enough. How is having to write
use namespace Foo\Bar\Baz;
better than
require_once("../Foo/Bar/Baz/functions.php");
On 29/01/2017 15:37, Wes wrote:
Curious that those who are posting here put all functions in the same file.
So, why don't you just require_once('Namespace/functions.php') ?
By that argument, why not just require_once('Namespace/ClassName.php)?
It turns out that many people find autoloading a m
Curious that those who are posting here put all functions in the same file.
So, why don't you just require_once('Namespace/functions.php') ?
"Niklas Keller" wrote in message
news:canuqdci945m2tddzty_tuuhdqn1xj9wjgsl_eqbyqr5f7_x...@mail.gmail.com...
I'm sorry, it's unacceptable for who? Only for not defined function it
would be called. If I call the same function a thousand times, the
autoload
will be attempted just the first tim
2017-01-28 21:37 GMT+01:00 Wes :
> I suppose that is because they use just few functions. I don't think you
> would want to have 20-30 functions in the same file :P
>
I wouldn't call these just a few functions:
- https://github.com/nikic/iter/blob/master/src/iter.php
- https://github.com/amphp
I suppose that is because they use just few functions. I don't think you
would want to have 20-30 functions in the same file :P
>
> I'm sorry, it's unacceptable for who? Only for not defined function it
> would be called. If I call the same function a thousand times, the autoload
> will be attempted just the first time, and if it doesn't work then the
> script would die, exactly like classes. Any project I know that uses
>
> > old applications could maintain compatibility only
> > by adding a simple autoloader that would alias the global
> function/constant
> > into the calling namespace
>
>
So as a side-effect of calling any function, my namespace would get
> polluted with all sorts of random names? That sounds like
> old applications could maintain compatibility only
> by adding a simple autoloader that would alias the global
function/constant
> into the calling namespace
So as a side-effect of calling any function, my namespace would get
polluted with all sorts of random names? That sounds like a messy
work
Importing functions from a static class would equally require to have all
functions in the same file. I was proposing an alternative to that, not
"symbol to file" autoloading.
Though, I know that problem well, sadly. I've suggested PHP should just
deprecate the fallback to root namespace, and remo
On Fri, 20 Jan 2017 10:04:44 +0300, Rasmus Schultz
wrote:
Just a quick thought.
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 appro
On 27 January 2017 09:23:38 GMT+00:00, Wes wrote:
>An alternative (which I haven't properly developed yet). Thoughts?
>\A\B\someFunction();
>// prints:
>// LOADING A\n
>// LOADING AB\n
As I understand it, PHP namespaces aren't really hierarchies, they just have a
hierarchical naming scheme; so n
An alternative (which I haven't properly developed yet). Thoughts?
```
define_autoload(AUTOLOAD_NS, function($ns){
if($ns === '\A\B\C'){
echo "LOADING ABC\n";
require(__DIR__ . $ns . '\functions_and_constants.php');
}
});
define_autoload(AUTOLOAD_NS, function($ns){
if(
On Thu, Jan 26, 2017 at 10:46 AM, Niklas Keller wrote:
> >
> > 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 app
>
> 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
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 m
> 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-stat
On 1/20/2017 7:58 PM, Nikita Popov wrote:
> On Fri, Jan 20, 2017 at 7:55 PM, 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(); //
On Fri, Jan 20, 2017 at 7:55 PM, 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. T
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 complet
> On Jan 20, 2017, at 01:04, Rasmus Schultz wrote:
>
> Just a quick thought.
>
> Since the autoloading functions proposal is stalled, how about allowing for
> import of static functions instead?
>
>use function Foo::bar;
>
>bar(); // calls Foo::bar()
>
...
> at least we can move ahea
On 1/20/2017 8:04 AM, Rasmus Schultz wrote:
> Just a quick thought.
>
> 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
Just a quick thought.
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 nee
26 matches
Mail list logo