Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52869 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15074 invoked from network); 3 Jun 2011 18:37:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2011 18:37:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=dhaarbrink@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dhaarbrink@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dhaarbrink@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:49499] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/29-08509-0D929ED4 for ; Fri, 03 Jun 2011 14:37:05 -0400 Received: by vwl1 with SMTP id 1so1791836vwl.29 for ; Fri, 03 Jun 2011 11:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=DU6Gn3pWz0xnGEZQALF4apgyuSN7gNDN0KqkEnxim8Y=; b=RQHklcGNlQXq6THrhru0UHFV3msKltfmmWRpnezsDiFBtsJPbR+ThyL/+teXIP+6I1 nDwnjFT4o4H7L6SdHwYaQG5da63qLYhv2lrso0Pa67Yx84P6Sy1MMkLJQr+fJmteLwPS jdX9blQWnZ5xobC1bbgTyI8DDEBnasXz1LCKE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=a5Vc/avK5szFEBs24gDLUEb7AL3ED7rnBaOqXLVKSUWbblXqP9oqm71I+hn6vP7q+e brLMRq78WbIHKUZiMI42yQybwXhmTc3sk1chITdSjJLTWqWMLQANMbmLkVWOObBQsoTU oamqEf/vhWbrrNHAnkZLv1nW1SWScQ1fXHvlw= Received: by 10.52.69.205 with SMTP id g13mr3143939vdu.241.1307126221420; Fri, 03 Jun 2011 11:37:01 -0700 (PDT) Received: from mail-vw0-f42.google.com (mail-vw0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id z5sm686209vby.3.2011.06.03.11.37.00 (version=SSLv3 cipher=OTHER); Fri, 03 Jun 2011 11:37:00 -0700 (PDT) Received: by vwl1 with SMTP id 1so1791829vwl.29 for ; Fri, 03 Jun 2011 11:37:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.147.193 with SMTP id m1mr753963vcv.245.1307126220566; Fri, 03 Jun 2011 11:37:00 -0700 (PDT) Received: by 10.220.164.136 with HTTP; Fri, 3 Jun 2011 11:37:00 -0700 (PDT) In-Reply-To: References: Date: Fri, 3 Jun 2011 20:37:00 +0200 Message-ID: To: John Crenshaw Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec54eeace0db19c04a4d30acf Subject: Re: [PHP-DEV] RFC: Enum From: dhaarbrink@gmail.com (Dennis Haarbrink) --bcaec54eeace0db19c04a4d30acf Content-Type: text/plain; charset=ISO-8859-1 2011/6/3 John Crenshaw > As much as I used enums in C++, I'm not sure that this is really the right > tool here, and it often introduces more problems than it solves. Specific > concerns that come to mind: > > 1. In C++ this often led to nasty needs such as a "LOG_LEVEL_COUNT" entry > at the end of the list of enums. > 2. Sometimes devs want to add items in the middle of the list for code > organization purposes. This silently changes the values of the other > constants and it isn't clear when that will or won't break stuff. > 3. Better than half the time, enums seem to be a series of bit flags, not > sequential numbers (in this case enum offers NO value over the current const > lists). > 4. The greatest value of enums in C++ is actually related to typesafety. > Admittedly, this was sometimes more of a frustration than a help, but that > was really just an implementation issue, not an inherent problem with enums > and typesafety. > 5. There is no clear path for extending the enums through inheritance. > > Allowing enums to be (optionally) named would open a clear path to address > counts and hinting, but still doesn't address the problems inherent in > automatic numbering, and would complicate the inheritance question. > > IMHO this should wait until we can address some of these items. Otherwise > the feature is just a halfbaked not-so-short shorthand for constants. > > John Crenshaw > Priacta, Inc. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > 1. I'm not so sure what you mean with that statement 2. A very strong argument for using the name of the constant as the default value 3 and 4: The way I see it, type safety is the *only* valid argument for proposing enums 5: I have never felt the need for inheritance in enums. Do you have a use case for that? I also think that enums should always be named. -- Dennis Haarbrink --bcaec54eeace0db19c04a4d30acf--