Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64342 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76290 invoked from network); 18 Dec 2012 15:00:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Dec 2012 15:00:33 -0000 Received: from [127.0.0.1] ([127.0.0.1:25771]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id B4/B9-33799-01580D05 for ; Tue, 18 Dec 2012 10:00:33 -0500 Authentication-Results: pb1.pair.com header.from=victor@suumit.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=victor@suumit.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain suumit.com from 98.139.212.177 cause and error) X-PHP-List-Original-Sender: victor@suumit.com X-Host-Fingerprint: 98.139.212.177 nm18.bullet.mail.bf1.yahoo.com Received: from [98.139.212.177] ([98.139.212.177:32947] helo=nm18.bullet.mail.bf1.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/A9-33799-C0180D05 for ; Tue, 18 Dec 2012 09:43:24 -0500 Received: from [98.139.215.142] by nm18.bullet.mail.bf1.yahoo.com with NNFMP; 18 Dec 2012 14:43:21 -0000 Received: from [76.13.13.42] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 18 Dec 2012 14:43:21 -0000 Received: from [127.0.0.1] by smtp103.prem.mail.ac4.yahoo.com with NNFMP; 18 Dec 2012 14:43:21 -0000 X-Yahoo-Newman-Id: 634485.29657.bm@smtp103.prem.mail.ac4.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: wmQ3ozAVM1lfdhF.HzaKWxyfp.yXYKwUzlz_j.tNk8GkYlP d9M2EXqvIQ._uQ5B4aAH0jAEd0soavx7jd6lGzdfqJ9GlC6uX8brj3hUbA65 wVSiHKv75v.gGi3cdnDBbYsUgxcGNxrjfnIODGY_5wgCKbgasndqAHRtU3Nn t59XpMGjBxkClyJgD88wCI2iHeCEheP6mLL.1PrYWdIEhJvz3PCXlM1fehsD Saa.7svd2lwUCwgPqNzjU5kVyU045CfobdVZMHoFuV0qlw59PDpSuG59aw2C EaC7F3geUBgplf2qzFShM4dopt07BBwxhIb0IHdr75cUqd4X7i.ttv3IGbsy Gjz1euBJaUzebDCLbG5VSk_ywHtwSP12O8qzgNIkigZNzvZNtsUuTXyxROhM 9MN67FE_Tup5vNOM3gFGRTb8zHt_1yXBj5HkNKYxPnVWHZaJdO2M63smG7.X L86dnmMO136jIL4.Ohhz3WbgiKeg- X-Yahoo-SMTP: JD6O2cuswBAWdaVT1ffr98ATm3fQ3wF_ou8N Received: from [192.168.0.10] (victor@82.236.98.234 with plain) by smtp103.prem.mail.ac4.yahoo.com with SMTP; 18 Dec 2012 06:43:21 -0800 PST Message-ID: <50D08108.1020503@suumit.com> Date: Tue, 18 Dec 2012 15:43:20 +0100 Reply-To: victor@suumit.com Organization: Suumit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: internals@lists.php.net Content-Type: multipart/alternative; boundary="------------020704000605070508080400" Subject: How about implementing more data structures (ie Map, Set) From: victor@suumit.com (Victor Berchet) --------------020704000605070508080400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------020704000605070508080400--