Dear all:

I would like to get your feedback on implementing some more data structure in the PHP core.

Things like Set, Map could be really helpful.

A Set would be an unordered collection with no duplicate elements (same as in Python)

$setA = new Set();
$setA->append('a');
$setA->append('a');

$setB = new Set();
$setB->append('b');

$setA == $setB;

// A set can hold objects
$set->append($object);

A Map would be an associative array that can hold objects (same as Python dictionaries)

$map= new Map();

$map[$setA] = 'Hello, world!';
echo $maps[$setB]; // Hello, world !

I can not really help with the implementation, however I could help defining the API, creating a test suite and docs should this idea be accepted.

Note: I had to implement this in PHP while working on Automaton, it's tedious and inefficient.

Thanks for your feedback,
Victor



Reply via email to