Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52859 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5281 invoked from network); 3 Jun 2011 11:14:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2011 11:14:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:56140] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/85-08509-D22C8ED4 for ; Fri, 03 Jun 2011 07:14:54 -0400 Received: by qwi4 with SMTP id 4so885421qwi.29 for ; Fri, 03 Jun 2011 04:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=41r6PajGC65w7xaUTn9l5pxuTE20A9pYDuAu/S1Z/X4=; b=YRU9jGiOVLmCtQVFrpbuHHdaYcTHrPXo2zKyt2UjNVYS31fOFeK8ds64FcjzRzRqjR Zrj5EG2+7gx07fw7jtkigVCcuLa6Yi98UPtuTsNk2t77t0Q2xIGEVBG5QSD7pAn2UvLU hwwI72KrrfajzOH/IIXWXZbDznbLiKaCAUnnM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; b=Ik64/PLoiZcR5fLpWsA0OTto2+9qthPaZabadREYePNWTDNsIwEseXqtFDCxPrKI52 Kkrq3T46XGFDKkONHsUfTyT3WJ4OJHvLizQUl2JSMYBG40d4PhZym7xTlcqYaM41o0V6 MAWTy0h0RpG04C+bOg46rf04k2tavN56r0mcg= Received: by 10.229.95.144 with SMTP id d16mr1370585qcn.37.1307099691109; Fri, 03 Jun 2011 04:14:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.80.79 with HTTP; Fri, 3 Jun 2011 04:14:31 -0700 (PDT) Reply-To: RQuadling@GMail.com In-Reply-To: References: Date: Fri, 3 Jun 2011 12:14:31 +0100 Message-ID: To: Dennis Haarbrink Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] RFC: Enum From: rquadling@gmail.com (Richard Quadling) On 3 June 2011 08:26, Dennis Haarbrink wrote: > So, to sum up: > - Do we really need enum level methods? > - Need to reach consensus on default values (strings vs auto inc. ints) > - RFC needs to be updated, explaining the type hinting of enums in method signatures I'm wondering if the enum storage would work like an array. The parallel ... array('YES', 'NO', 'MAYBE') vs. enum{YES, NO, MAYBE} In this example, all the keys of the array would be the same as the values of the enum array(0 => 'YES', 1 => 'NO', 2 => 'MAYBE') vs. enum(YES = 0, NO = 1, MAYBE = 2} In both cases, there is a name/value pairing. In both cases an unassigned key (for the array) or value (for the enum) is automatically determined. If a non sequential integer value is used ... array(2047 => 'E_ALL_PRE_5_2', 6143 => 'E_ALL_5_2', 30719 => 'E_ALL_5_3') vs enum{E_ALL_PRE_5_2 = 2047, E_ALL_5_2 = 6143, E_ALL_5_3 = 30719} then this still follows a recognisable pattern of key/value. If a non numeric key(array) or value(enum) is used, then I think the enum{} should follow the existing array() rules. If a mix is used, then there is already a well documented pattern of behaviour that I think should be followed. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea