From: Robert Klemme Date: 2007-05-28T18:20:20+09:00 Subject: Re: Tricky problem with === On 27.05.2007 15:23, Erwin Abbott wrote: > On 5/27/07, Robert Klemme wrote: >> Viewing this more abstract: maybe case isn't even the right thing to do. >> We would have to know more about what the OP is trying to accomplish. > > Well the idea is to wrap an object with this proxy class and not mess > up any code that doesn't know about it... it should seem completely > transparent. It gives you a separate namespace for methods and > instance variables, so you don't have to worry about redefining those > with a mixin or singleton method, but you can still specialize some > object by wrapping it. Yes, you said so earlier. But what business problem are you trying to solve? >> I think using case statements to distinguish the class of an object is >> kind of ugly under any circumstances. > > I think it works pretty well, but I'd like to know what you prefer > instead. I realize distinguishing objects by class is not encouraged, > but I find myself needing it often, for better or worse. > >> On an even more general level there is a certain contradiction between >> having something behave exactly like an Array - but also different... :-) > > Yes, that's a good observation. Though I'm very happy with how close > I've gotten to making it happen. The problem is that it seems to be a fine line between coming close and breaking. :-) I'd also consider mixins or other mechanisms. It all depends on what problem you are trying to solve... Kind regards robert