Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51447 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48024 invoked from network); 14 Feb 2011 15:45:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2011 15:45:07 -0000 X-Host-Fingerprint: 92.198.40.181 port-92-198-40-181.static.qsc.de Received: from [92.198.40.181] ([92.198.40.181:19115] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/70-44718-10E495D4 for ; Mon, 14 Feb 2011 10:45:07 -0500 Message-ID: To: internals@lists.php.net Date: Mon, 14 Feb 2011 16:45:03 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 References: <8423995CEEEA844CB2F964B14BCA94CD043A9686@PRODEXCHANGE02.ilchildcare.org> In-Reply-To: <8423995CEEEA844CB2F964B14BCA94CD043A9686@PRODEXCHANGE02.ilchildcare.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 92.198.40.181 Subject: Re: Clarification on the Enum language structure From: thomas.gutbier@anthrotec.de (Thomas Gutbier) Jarrod Nettles wrote: > So, my proposed syntax would look something more like this. I think also and was wondering about the current rfc for a few weeks. Im not a core developer but I want to outline what i would expect as php framework developer. > namespace System\Logs > { > enum Levels{ > DEBUG, > INFO, > WARNING, > ERROR > }; > } Yes, after that I would expect a new type "Levels" and the possibility to do something like this: $log = new Levels; $log = WARNING; or $log = new Levels(WARNING); Like the current rfc i think, therefore we need the corresponding constants to be defined by defining the Levels type. Furthermore we should have the appropriate type hints for function/method calls. Assuming, we have a method like this public function setLogLevel (Levels $logLevel) { $this->logLevel = $logLevel; } i would like to call them by delivering $log as a parameter $someLogginObject->setLogLevel($log) and get an error in the case the type of $log is not Levels. What do you think about a viable approach to implement a enum language structure. The current rfc seams not very useful for me. Thanks! Thomas Gutbier Web Developer Hannover, Germany