From: Clifford Heath Date: 2007-10-09T16:35:09+09:00 Subject: Re: The Open-Closed-from-a-certain-angle Principle Jay Levitt wrote: > What if class definitions were viewed through a magic prism, where only > those classes looking from the right perspective saw the new extensions? ... > Do other languages do anything like that? I put a lot of thought into this over the last ten years because I spent a long time thinking about Aspect Oriented *Design*. What you're suggesting is what the term "aspect-oriented programming" *ought* to attach to. The idea of aspects is that everything has many facets, and only some of those facets are visible at once, only those that belong to aspects that are in view. In this way each aspect injects additional "features" into one or more classes.... but they shouldn't be allowed to change behaviour (break expectations, slightly weaker) of any users unaware of the aspect. To do this without breaking encapsulation, each facet may only use the public interface of the object, and in fact shouldn't affect the object's state... pretty restrictive. When you consider deeply what's required to do it without obscure side-effects, it must be too restricted to be very useful. I don't know of any programming languages that really do it. Then there's a whole lot of interesting things to do with delayed facet realization... sorta like instantiation, but to add a facet to an object created by a user having no knowledge of the aspect in which it's now being used. I don't know, it might be possible to construct a useful language that does it, but I don't think Ruby is the right starting point, and I couldn't work out exactly how it'd look. AOD works very well for me though... It helps to keep people's mind on the discussions when they know their off-topic contributions can be filed to be discussed later (under another aspect), instead of just shrugged off. Clifford Heath.