Kris Craig wrote on 16/02/2015 01:40:
create the static instance
Isn't that essentially a contradiction in terms? I can't help but
feel that blurring the line between static and non-static
classes/methods would cause more harm than good.
I've never really done any work with Redis before
Hello Internals,
seeing the static calling of instance methods being discussed again, I want
to ask whether the following idea would maybe have a chance?
In our codebase we have one set of classes where it was very useful to be
able to call the same methods both statically and nonstatically: a
Am 15.02.2015 21:05 schrieb Rowan Collins rowan.coll...@gmail.com:
This sounds to me like you should just be using the Singleton pattern,
Of course this is singleton under the hood.
// Now wherever in the code you want the default instance, just use this:
$value =
2015-02-15 21:04 GMT+02:00 Patrick Schaaf p...@bof.de:
Hello Internals,
seeing the static calling of instance methods being discussed again, I want
to ask whether the following idea would maybe have a chance?
In our codebase we have one set of classes where it was very useful to be
able to
On 15/02/2015 19:04, Patrick Schaaf wrote:
In our codebase we have one set of classes where it was very useful to be
able to call the same methods both statically and nonstatically: a set of
wrapper classes over phpredis where subclasses know which set of redis
servers to talk to (plus other
On 15/02/2015 20:20, Patrick Schaaf wrote:
Am 15.02.2015 21:05 schrieb Rowan Collins rowan.coll...@gmail.com
mailto:rowan.coll...@gmail.com:
This sounds to me like you should just be using the Singleton pattern,
Of course this is singleton under the hood.
// Now wherever in the code you
On 15/02/2015 19:04, Patrick Schaaf wrote:
By neccessity the implementation of this class set, must make use of both
__call() and __callStatic() magic methods, with both then dispatching to a
delegate phpredis instance, and in the case of __callStatic(), making
up-front a singleton like new self
Patrick Schaaf wrote:
Am 15.02.2015 21:05 schrieb Rowan Collins rowan.coll...@gmail.com:
// Now wherever in the code you want the default instance, just use this:
$value = MyRedis::singleton()-get($key);
You can surely see how this is more readable / easier to write:
$value =
create the static instance
Isn't that essentially a contradiction in terms? I can't help but feel
that blurring the line between static and non-static classes/methods would
cause more harm than good.
I've never really done any work with Redis before so I'm also having
trouble understanding the
Am 15.02.2015 23:34 schrieb Rowan Collins rowan.coll...@gmail.com:
You can surely see how this is more readable / easier to write:
$value = MyRedir::get($key);
Actually, no, I find that harder to read accurately - there is no clue
there that there is actually a singleton under the hood, and
Am 16.02.2015 02:40 schrieb Kris Craig kris.cr...@gmail.com:
I've never really done any work with Redis before so I'm also having
trouble understanding the use case for this given that everybody's talking
about this solely in the context of Redis.
Ahem, it's not everbody, just me :) And the
Am 16.02.2015 00:05 schrieb Rowan Collins rowan.coll...@gmail.com:
A quick thought - if you want to stick with the magic static call
pattern, you can implement this much more simply by doing something similar
to Laravel's facades [1]:
...
This basically implements in userspace what you propose
12 matches
Mail list logo