Restricting types of slots in subclasses? 
Author Message
 Restricting types of slots in subclasses?

Using gd 2.3.2, take a class:

    define class <test-1> (<object>)
      slot hole :: <vacuum>;
    end class <test1>;

Should it be possible to restrict the type of 'hole' in a subclass?  
Something like:

    define class <test-2> (<test-1>)
      inherited slot hole :: <subtype-of-vacuum>;
    end class <test2>;

'Dylan Programming', section 19.5 (Enumerations), seems to indicate
that one can use keywords to achieve this, but alas! keywords are on
holiday from gd and the above code leads to a syntax error when parsing.  
Any workable way around this?

Glenn



Sun, 17 Mar 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Problem with <each-subclass-slot-info>

2. each-subclass slot specializer working examples?

3. Restricting := versus restricting =

4. Restricting extended types - can it be done?

5. Type Compatibility b/w arrays of class/subclass

6. subclasses, __methods__ and type()

7. Creating subclasses of builtin types

8. Different types of subclasses in Objectworks for Smalltalk 2.5

9. beginner - Objectclass slot type

10. Typed-slots?

11. changing slots in an overloaded initialize-instance, and type checking

12. Optimizing defmethod and slot type inference

 

 
Powered by phpBB® Forum Software