Re: Pseudo-objects (methods on arrays, strings, etc.)

From: Date: Wed, 18 Jul 2012 20:08:57 +0000
Subject: Re: Pseudo-objects (methods on arrays, strings, etc.)
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> I think there is something we can do around this...

Reviewing the php array functions it seems to me that a new API would benefit from some sort of more
intuitive organization, possibly around meta concepts specific to use.

For example, I want to re-order an array (order is a meta-concept in this description) how I
specifically want to re-order the array is a sub-concept or sub-property of this general thought
process. If you're following me then an intuitive API would look something like array functions
condensed into a small handful of more generalized functions that take an argument to specify their
exact behavior. I.e. 

array_order($my_array, 'sort', 'alpha', 'asc'); 

as a rough idea or breaking away from the traditional API a bit further 

array_order->sort($my_array, 'alpha', 'asc');

I'm offering this as a general representation of the idea to organize and condense the API not
as a fully flushed out representation of the end result so useful feedback would be around the
concept and not the semantics hastily hatched code examples.

- Bill







Thread (66 messages)

« previous php.internals (#61432) next »