Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64344 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86283 invoked from network); 18 Dec 2012 16:44:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Dec 2012 16:44:06 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.175 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.175 mail-vc0-f175.google.com Received: from [209.85.220.175] ([209.85.220.175:56388] helo=mail-vc0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 52/DA-33799-45D90D05 for ; Tue, 18 Dec 2012 11:44:06 -0500 Received: by mail-vc0-f175.google.com with SMTP id fy7so1112699vcb.34 for ; Tue, 18 Dec 2012 08:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=u2SkBD60C8rlzR+xXwxZor286Eb4Dt8nZtvgblPEdPc=; b=LgePbbZf6Qa1XSG+ivNc97TOxs7fXkBIpnnf1v++W/VtJJK2mXTAdN2YFYiMCKBehX YPWMDzrapsy/MrPVtGB2onsG8c8gAeX0YpcvhgAos8d+n5zb9gIUdun4fZ21voKX8BvI tSMFnokdmYGpLTzgDbN90LpElYOhUVRtVOBtct0kUcvhUA1W1CrSvGpDiqc2lEiMiU+N iYePVopj/gdoAdgc4hP7WHc9e/jfdGqpbTBuwWVm3vmPGQwDfpPPT10tInuPg1gMUx2k abEEEEgSc5GN7hcSgDfdJKPpX1NfbAQ7YPpxA/A0l/x23msixxbpVvo0SCJ560Fi5rDc DzFQ== Received: by 10.220.115.133 with SMTP id i5mr3959911vcq.42.1355849041884; Tue, 18 Dec 2012 08:44:01 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.220.140.132 with HTTP; Tue, 18 Dec 2012 08:43:21 -0800 (PST) In-Reply-To: <50D08108.1020503@suumit.com> References: <50D08108.1020503@suumit.com> Date: Tue, 18 Dec 2012 17:43:21 +0100 X-Google-Sender-Auth: vnRYR0flwCb0Tt1hSlzOuz614Ps Message-ID: To: victor@suumit.com Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d0434c06882b61b04d12334a5 Subject: Re: [PHP-DEV] How about implementing more data structures (ie Map, Set) From: jpauli@php.net (jpauli) --f46d0434c06882b61b04d12334a5 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Dec 18, 2012 at 3:43 PM, Victor Berchet wrote: > 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 > Cool ! I recall some people have already talked about that in the past, have you read about this ? So, the process is always the same : wait for ppl feedback, write an RFC, create patches, test&debug, call for vote, etc.. :-) Julien.P --f46d0434c06882b61b04d12334a5--