[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    Re: AW: [PHP-DEV] Importing namespaced functions
From:       Pascal Chevrel <pascal.chevrel () free ! fr>
Date:       2013-04-24 9:16:46
Message-ID: 5177A2FE.4020606 () free ! fr
[Download RAW message or body]

Le 24/04/2013 08:15, Martin Keckeis a écrit :
> Hello together,
>
> if you got a namespace with more than one functions, why not just create a
> container class and make the methods static?
> I know it's not exactly the same, but how many times you need this....
>
> So you can write:
> namespace Abc\Def;
>
> class Something{
>      public static function blubb();
>
>      public static function blubb2();
> }
>
>
> use Abc\Def\Something;
>
> Something::blubb();
> Something::blubb2();
>
> Best regards
> Martin
>
>

Hi,

I already had the need to override an existing function, specifically 
the _() gettext calls with my own code. In a python project I work on, 
we partly use gettext technology, we use it for string extraction from 
templates, but we don't use gettext for string display. In PHP, AFAIK, I 
can't do that, I can't tell the code that in context A the call uses 
gettext and in context B, the call uses a different localization backend 
with the same function call. I know it's probably not a common case, but 
in PHP I don't have a workaround (that I know of). Note that I don't 
know if it would be good for the language to have this possibility, I 
just know that it would be good for me :)

Regards,

Pascal

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic