home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / LIBRARY / ABSTRACT.SA next >
Text File  |  1994-10-25  |  3KB  |  73 lines

  1. -- Copyright (C) International Computer Science Institute, 1994.  COPYRIGHT  --
  2. -- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
  3. -- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
  4. -- the file "Doc/License" of the Sather distribution.  The license is also   --
  5. -- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
  6. --------> Please email comments to "sather-bugs@icsi.berkeley.edu". <----------
  7.  
  8. -- abstract.sa: Abstractions indicating the presence of features.
  9.  
  10. -------------------------------------------------------------------
  11. -- $IS_EQ{T}: Subtypes define "is_eq(T):BOOL".
  12. -- $IS_LT{T}: Subtypes define "is_lt(T):BOOL".
  13. -- $HASH: Subtypes define "hash:INT".
  14. -- $NIL{T}: Subtypes define "nil:T".
  15. -------------------------------------------------------------------
  16. type $IS_EQ{T} is
  17.    -- Subtypes of this define "is_eq(T):BOOL". Typically used in 
  18.    -- typecases to use instead of "=". Examples: INT < $IS_EQ{INT}, 
  19.    -- STR < $IS_EQ{STR}.
  20.    
  21.    is_eq(e:T):BOOL;        -- True if self is equal arg for 
  22.       -- this element type.
  23. end;
  24.    
  25. -------------------------------------------------------------------
  26. type $IS_LT{T} is
  27.    -- Subtypes of this define "is_lt(T):BOOL". Typically used in 
  28.    -- typecases. Examples: INT < $IS_LT{INT}, STR < $IS_EQ{STR}.
  29.    
  30.    is_lt(e:T):BOOL;        -- True if self is less than arg for 
  31.       -- this element type.
  32. end;
  33.  
  34. -------------------------------------------------------------------
  35. type $HASH is
  36.    -- Subtypes of this define "hash:INT". Typically used in 
  37.    -- typecases. Example: STR < $HASH.
  38.    
  39.    hash:INT;            -- A hash value for self.
  40.       -- Elements which are "is_eq", if defined, should return the 
  41.       -- same hash value. 
  42. end;
  43.  
  44. -------------------------------------------------------------------
  45. type $NIL{T} is
  46.    -- Subtypes of this define "nil:T". Typically used in typecases.
  47.    -- Example: INT < $NIL{INT}.
  48.    
  49.    nil:T;            -- A special value to be used in 
  50.       -- sets to represent the absence of an element.
  51. end;
  52.  
  53. -------------------------------------------------------------------
  54. type $REHASH is
  55.    -- Subtypes of this define "rehash".  Any class whose objects need
  56.    -- to perform special operations when they are moved of copied
  57.    -- should be a subtype.  The rehash routine is called on such
  58.    -- objects if the system changes their location (for instance,
  59.    -- during garbage collection).
  60.  
  61.    rehash;            -- Make whatever changes are needed 
  62.       -- after an object is copied or moved.
  63. end;
  64.  
  65. -------------------------------------------------------------------
  66. type $STR is
  67.    -- Subtypes of this define "str:STR". This should be a reasonable
  68.    -- string representation of an object.
  69.  
  70.    str:STR;            -- String form of object. 
  71. end;
  72. -------------------------------------------------------------------
  73.