Re: Ruby's symbols

From: Date: Sat, 05 Jan 2013 23:43:08 +0000
Subject: Re: Ruby's symbols
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-64576@lists.php.net to get a copy of this message
On Sat, Jan 5, 2013 at 3:39 PM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote: > On 01/05/2013 03:36 PM, Kris Craig wrote: > > > > > > On Sat, Jan 5, 2013 at 3:32 PM, Rasmus Lerdorf <rasmus@lerdorf.com > > <mailto:rasmus@lerdorf.com>> wrote: > > > > On 01/05/2013 03:29 PM, Kris Craig wrote: > > > > > In both cases, we really don't care what the actual values of > > brown, black, > > > and purple are. We just want it to be unique so we can reference > > each of > > > them in a visually friendly way with minimal performance impact. > > That's > > > where I could see a valid use-case for Ruby-like symbols in PHP. > > > > What you are describing is just an enum. That's not really what Ruby > > symbols are about. > > > > -Rasmus > > > > > > Ruby doesn't have native enums. Symbols are often used in Ruby code to > > obtain the same functionality, though. > > Right, but if that is the only use you can come up with for them in PHP, > then there are way simpler ways to do it. We already have an enum RFC. > https://wiki.php.net/rfc/enum > > -Rasmus > > Granted, but other use-cases have already been presented as well. Obviously the one I suggested would no longer be useful if PHP adopts enums. --Kris

« previous php.internals (#64576) next »