Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52868 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13176 invoked from network); 3 Jun 2011 18:27:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2011 18:27:42 -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:57256] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/D8-08509-D9729ED4 for ; Fri, 03 Jun 2011 14:27:41 -0400 Received: by vwl1 with SMTP id 1so1784916vwl.29 for ; Fri, 03 Jun 2011 11:27:37 -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=/OXJ3ZEv4TOA/K4SNt8mkYHVJ+8zC5JsqQ+wieS1Gqk=; b=kTOxHYOjKdF/bwforjuvtdAKOlFnPLewbcewEkQuZ45K0bdAg8EDmqKkHBqrRaZ7o0 Dfl3RapAP3pghyOo9B9pikxNmjnGN5uCv8htOu4udIAXJ2jI/VqBEiKdUw73PyhkgsZQ CDPG9JGPuio4Xa9Tj89ut3Q3TlbxMEpoyG+2s= 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=p9SDuiwX/Vv0vUlear84gjldMsdFPjt6YS8+KFCl3WSlSVu86O6wZ+iuigAMzoa/7A WYsWir5DWXo3DrDnRDm5Ws555n18QE2yT1IRNnsex7FnxPSwDQE6CDfo++zKygYMzkPY LvP21/NAftppRF097fNG1K2qLf4gYEXw+vtq4= Received: by 10.220.47.195 with SMTP id o3mr686579vcf.101.1307125657437; Fri, 03 Jun 2011 11:27:37 -0700 (PDT) Received: from mail-vx0-f170.google.com ([209.85.220.170]) by mx.google.com with ESMTPS id o2sm261514vct.19.2011.06.03.11.27.36 (version=SSLv3 cipher=OTHER); Fri, 03 Jun 2011 11:27:36 -0700 (PDT) Received: by vxb40 with SMTP id 40so1766697vxb.29 for ; Fri, 03 Jun 2011 11:27:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.172.213 with SMTP id m21mr754770vcz.210.1307125655961; Fri, 03 Jun 2011 11:27:35 -0700 (PDT) Received: by 10.220.164.136 with HTTP; Fri, 3 Jun 2011 11:27:35 -0700 (PDT) In-Reply-To: <4DE8F971.8070606@croscon.com> References: <4DE8F971.8070606@croscon.com> Date: Fri, 3 Jun 2011 20:27:35 +0200 Message-ID: To: Marcel Esser Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016e68972306680f304a4d2e841 Subject: Re: [PHP-DEV] RFC: Enum From: dhaarbrink@gmail.com (Dennis Haarbrink) --0016e68972306680f304a4d2e841 Content-Type: text/plain; charset=ISO-8859-1 2011/6/3 Marcel Esser > On 6/3/2011 8:27 AM, Dennis Haarbrink wrote: > >> As soon as I have my requested write permission in the rfc namespace i >> will >> update it. >> >> -- >> Dennis Haarbrink >> >> >> 2011/6/3 Pierrick Charron >> >> Hi, >>> >>> The RFC was supposed to be a draft (i didn't really added it in the good >>> section) and was written more to introduce the idea and make people think >>> about it. >>> Feel free to update it with any idea, concern you may have. >>> >>> Pierrick >>> >>> >>> On 3 June 2011 03:26, Dennis Haarbrink wrote: >>> >>> One thing I would really like to see in 5.4 is enums. >>>> There is already an RFC for that: https://wiki.php.net/rfc/enum >>>> >>>> This was discussed in february this year, but no consensus was reached. >>>> IIRC, the most notable problems were: >>>> - What is the 'value' of enum constant: string or int, user defined >>>> scalar, >>>> defaults >>>> - Ability to make enums more 'class like', some people wanted to be able >>>> to >>>> add methods. >>>> >>>> Another thing which was discussed (and I think most people agreed on >>>> that), >>>> but is not in the RFC: type hinting in method signatures. >>>> >>>> >>>> I think we should keep this simple proposal simple, let it be an enum in >>>> all >>>> its simplicity. >>>> The toughest part would be to decide what would be the default value. >>>> Some >>>> proposed to use the name of the constant, which is imho best for >>>> debuggability (i like this one the best), or an auto incrementing int, >>>> saying that it is better performance wise and which is more analog with >>>> mysql's enum type. >>>> >>>> >>>> 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 >>>> >>>> >>>> >>>> Regards, >>>> Dennis Haarbrink >>>> >>>> >>> If I might raise the question, I am also really interested in how enums > could respond across namespace. Personally, I am not entirely sure about the > ability to add methods to enums. That sounds like a class, to me. However, > the second example on the RFC of use-case, wherein the developer uses a > class to contain constants, sounds to me like a namespacing issue. Would > enums be objects that are within the scope of the namespace, like classes, > or would they be global? I would personally favor they remain in the scope > of the namespace. That removes the need to prefix them with any sort of > pseudo-namespace (like a class, for example), and it prevents collisions, of > course. > > - M. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I'm also not so sure about inlining an enum in a class. I think they should always be first class citizens. And as such they adhere to the same namespace rules as classes. Maybe Pierrick can clarify his intentions. -- Dennis Haarbrink --0016e68972306680f304a4d2e841--