home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / clos / 1005 < prev    next >
Encoding:
Text File  |  1992-11-20  |  5.3 KB  |  100 lines

  1. Newsgroups: comp.lang.clos
  2. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!charest
  3. From: charest@Aig.Jpl.Nasa.Gov (Len Charest)
  4. Subject: Extending syntax/semantics of method specializers
  5. Message-ID: <1992Nov20.221251.28590@jpl-devvax.jpl.nasa.gov>
  6. Keywords: metaobject method specializer dispatch
  7. Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post)
  8. Nntp-Posting-Host: ai-cyclops
  9. Reply-To: charest@aig.jpl.nasa.gov
  10. Organization: NASA/Jet Propulsion Laboratory
  11. Date: Fri, 20 Nov 1992 22:12:51 GMT
  12. Lines: 86
  13.  
  14. Is there a (generic) function that when given a parameter-specializer-name will
  15. return the corresponding specializer object? How about a function that returns a
  16. form that when evaluated will return the specializer.?
  17.  
  18. I want to extend the syntax of DEFMETHOD and other method defining forms in one
  19. of the following ways:
  20.  
  21. 1. A list of the form (SATISFIES <symbol>) is a valid parameter-specializer-name.
  22. The <symbol> would name a function of exactly one argument.
  23. 2. A function of exactly one argument is a valid parameter-specializer-name.
  24.  
  25. In either case, the parameter-specializer-name would resolve to a specializer
  26. object that held a function of exactly one argument. Semantics: at method
  27. dispatch time, the function would be called as a predicate with the corresponding
  28. value of the specialized method argument. If the predicate were to return NIL and
  29. the method were otherwise applicable (e.g., as determined by
  30. COMPUTE-APPLICABLE-METHODS) then the method would no longer be applicable. This 
  31. approach would faciliate dispatch based on, for example, the run-time (or GF 
  32. call-time) value of global variables, user-defined types, etc.
  33.  
  34. After consulting AMOP, I believe I'll need to do the following to implement such
  35. 'satisfies-specializers': define specialized metaobject classes based on
  36. STANDARD-GENERIC-FUNCTION and STANDARD-METHOD; define methods on
  37. COMPUTE-APPLICABLE-METHODS and COMPUTE-APPLICABLE-METHODS-USING-CLASSES; define
  38. methods on SPECIALIZER-DIRECT-GENERIC-FUNCTIONS and SPECIALIZER-DIRECT-METHODS; 
  39. define a class of satisfies-specializers to support everything else. All of this
  40. is no big deal.
  41.  
  42. However, there seems to be no protocol for converting specializer-names into
  43. specializer objects. AMOP defines an abstract class called SPECIALIZER and a
  44. direct subclass called EQL-SPECIALIZER (table 5.1, p 141), but there is no 
  45. supporting protocol for creating/using such objects. What I need to implement 
  46. satisfies-specializers is a set of functions for generically generating 
  47. specializer objects from a given specializer-name. These functions would
  48. form a 'specializer initialization protocol'. These functions then need to
  49. become a part of the initialization protocol for method objects.
  50.  
  51. Proposal: I propose the following additions to the MOP (as described in AMOP). 
  52. If the processing of DEFMETHOD (as described on p 149-150 in AMOP) were 
  53. revised to include use of these functions then I'd have a portable way of 
  54. writing satisfies-specializers.
  55.  
  56. SPECIALIZER-OBJECT (specializer-name)                       [Generic Function]
  57.   This generic function returns the specializer object associated with
  58. specializer-name. 
  59. SPECIALIZER-OBJECT ((specializer-name symbol)                         [Method]
  60.   This method calls (FIND-CLASS specializer-name).
  61. SPECIALIZER-OBJECT ((specializer-name list))                          [Method]
  62.   This method calls (TYPE-SPECIALIZER-OBJECT (CAR specializer-name) (CDR
  63. specializer-name)). The value returned by TYPE-SPECIALIZER-OBJECT is the value
  64. returned by this function.
  65.  
  66. TYPE-SPECIALIZER-OBJECT (type-specifier subsidiary-info)    [Generic Function]
  67.   This generic function returns the specializer object associated with the
  68. given type-specifier and its subsidiary-info.
  69. TYPE-SPECIALIZER-OBJECT ((type-specifier (eql 'eql)) subsidiary-info  [Method]
  70.   This method calls (INTERN-EQL-SPECIALIZER (CAR subsidiary-info)).
  71. TYPE-SPECIALIZER-OBJECT ((type-specifier (eql 'satisfies))            [Method]
  72.                          subsidiary-info)
  73.   This method computes the satisfies-specializer object associated with the 
  74. given subsidiary-info.
  75.  
  76. Notes: As implied by the above, any specializer-name that is a list is 
  77. interpreted to be a 'type-specializer-name'. Thus, eql-specializer-names are
  78. no longer unique in their role as list-valued specializer-names. This approach
  79. opens up the possibility of a wide range of method specialization strategies. 
  80. This is also the approach necessary to support extension 1 above. 
  81.  
  82. If the role of eql-specializers is not to be changed, then we could fall back
  83. on the syntax of extension 2, thereby obviating the need for 
  84. TYPE-SPECIALIZER-OBJECT. The methods on SPECIALIZER-OBJECT would be ammended 
  85. as follows:
  86.  
  87. SPECIALIZER-OBJECT ((specializer-name symbol)                         [Method]
  88.   This method calls (FIND-CLASS specializer-name).
  89. SPECIALIZER-OBJECT ((specializer-name list))                          [Method]
  90.   This method calls (INTERN-EQL-SPECIALIZER specializer-name).
  91. SPECIALIZER-OBJECT ((specializer-name function))                      [Method]
  92.   This method computes the satisfies-specializer object associated with 
  93. specializer-name.
  94.  
  95. Comments?
  96. ..................................................
  97.                                   Len Charest, Jr.
  98.                  JPL Artificial Intelligence Group
  99.                           charest@aig.jpl.nasa.gov
  100.