From: Matthew Kerwin Date: 2013-02-06T11:04:05+09:00 Subject: Re: Symbol.defined? --f46d042f9546a78dc004d504baea Content-Type: text/plain; charset=ISO-8859-1 On 6 February 2013 11:28, Student Jr wrote: > Symbol deserialization from external sources is now known to be > problematic. Is it also quite useful. > > Here's what I want, kinda: > > class Symbol > def self.defined?(string) > all_symbols.any?{|sym| sym.to_s == string} > end > end > > Unfortunately, this is REALLY going to be slow. How about native? > I might be missing something, but how is `string.to_sym` problematic? -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd --f46d042f9546a78dc004d504baea Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 6 February 2013 11:28, Student Jr <= ;lists@ruby-forum= .com> wrote:
Symbol deserialization from external sources= is now known to be
problematic. =A0Is it also quite useful.

Here's what I want, kinda:

class Symbol
=A0 def self.defined?(string)
=A0 =A0 all_symbols.any?{|sym| sym.to_s =3D=3D string}
=A0 end
end

Unfortunately, this is REALLY going to be slow. =A0How about native?

I might be missing som= ething, but how is `string.to_sym` problematic?

<= /div> --
=A0 Matthew Kerwin, B.Sc (CompSci) (Hons)
=A0 http://matthew.kerwin.net.au/<= br>=A0 ABN: 59-013-727-651

=A0 "You'll never find a program= ming language that frees
=A0 you from the burden of clarifying your ideas." - xkcd
--f46d042f9546a78dc004d504baea--