From: Aredridel Date: 2004-09-04T03:04:13+09:00 Subject: Re: Not just $SAFE, but damn $SAFE On Fri, 2004-09-03 at 17:08 +0900, ts wrote: > >>>>> "A" == Aredridel writes: > > A> Class === obj # Bad, because you can define an evil subclass. > > This is not a problem. > > 1) if you use `case', you can trust the result (i.e. an object can't "lie") Except that by using case, I can have an EvilString < String, for which that returns true. > 2) you know that some methods are safe. For example, if you have a String > or an Exception use String.new(obj). If you have an Integer or a > Bignum, use Integer(String.new(obj.to_s)). If you have a Time object > use Time.at(obj), etc > > Now, if you have a container (Array, Hash, ...) just create a new > container and store it only "safe" objects. Yup. That's similar to what we're doing. The problem lies in to_s, in that our eventual goal is to output text. Any deep data structure is harder to deal with. Ari