Types (was: Attribute vs Instance Variable) 
Author Message
 Types (was: Attribute vs Instance Variable)

Quote:



> > Does a type have to be manifest? To my mind it need not. For an object
> > to be of a particular type it is enought that it counterfactually(!)
> > behaves appropriately. I take type to be a purely behavi{*filter*}notion --
> > but then I have not read up on the theoretical discussion.

> Cecil's predicate classes are an interesting take on this.  To quote
> from  

http://www.*-*-*.com/
icate-classes.html:
[snip]
Quote:
> However, unlike a normal class, an object is
> automatically an instance of a predicate class whenever it satisfies a
> predicate expression associated with the predicate class.

[snip]

Yes, indeed I had predicate classes in mind when I wrote the above
paragraph. IMHO, they are a much a much cleaner solution to the problem
the Type Object pattern, see Johnson & Woolf in PLoPD 3, attacks: The
need to deal with a possibly large number of ephemeral classes at run
time.

The motivating example for Type Object is a video store that has to
handle a potentially open-ended number of movie titles (types) and a
number of actual copies (instances) of each of the titles.

The Type Object approach has the drawback that it thwarts polymorphism.
And beyond that it's not really elegant to have an explicit minimal
object model at the application level.

To the folks in comp.lang.dylan: How do you feel about predicate classes
in Dylan?

Michael

--
Michael Schuerig

http://www.*-*-*.com/



Tue, 30 Oct 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Variable interpolation or indirection for instance attributes

2. Class attribute or instance attribute?

3. PEP 8: on member variables vs. attributes

4. Newbie Tip: Classes and variable passing vs instances from ENGSOL

5. Class vs instance variables?

6. range(Instance) vs. foo[Instance]

7. Instances incorrectly sharing instance variables?

8. procedure variables vs. type-bound procedures

9. type(type) is an object, not an instance

10. del(instance.attr) -- no attribute

11. Viewing instance attributes in IDLE's debugger

12. unintentionaly shared attributes in two different instances

 

 
Powered by phpBB® Forum Software