Method.st
changeset 2022 24529e2b7cee
parent 1995 8b9aeb092b59
child 2023 4c6416d1a54d
--- a/Method.st	Thu Jan 02 14:10:43 1997 +0100
+++ b/Method.st	Thu Jan 02 15:04:53 1997 +0100
@@ -2596,6 +2596,35 @@
     "Modified: 4.11.1996 / 23:18:05 / cg"
 ! !
 
+!Method::MethodWhoInfo class methodsFor:'documentation'!
+
+documentation
+"
+    In earlier times, Method>>who returned an array filled
+    with the methods class and selector.
+    This was done, since a smalltalk method cannot return multiple
+    values, but 2 values had to be returned from that method.
+    Thus, the who-interface was used as:
+        info := <someMethod> who.
+        class := info at:1.
+        sel := info at:2.
+
+    Sure, this is ugly coding style, and the system has been changed to return
+    an object (an instance of MethodWhoInfo) which responds to the two
+    messages: #methodClass and #methodSelector.
+    This allows to write things much more intuitive:
+        info := <someMethod> who.
+        class := info methodClass.
+        sel := info methodSelector.
+
+    However, to be backward compatible, the returned object still responds to
+    the #at: message, but only allows inices of 1 and 2 to be used.
+
+    The MethodWhoInfo class is private to Method - its not visible to other
+    classes.
+"
+! !
+
 !Method::MethodWhoInfo class methodsFor:'instance creation'!
 
 class:cls selector:sel
@@ -2605,11 +2634,25 @@
 !Method::MethodWhoInfo methodsFor:'accessing'!
 
 methodClass
+    "return the class which contains the method represented by myself"
+
     ^ myClass
+
+    "
+     (Method compiledMethodAt:#who) who methodClass
+     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass
+    "
+
+    "Modified: 2.1.1997 / 14:59:02 / cg"
 !
 
 methodSelector
+    "return the selector under which the the method represented by myself
+     is found in the class"
+
     ^ mySelector
+
+    "Modified: 2.1.1997 / 14:59:24 / cg"
 ! !
 
 !Method::MethodWhoInfo methodsFor:'compatibility'!
@@ -2645,6 +2688,6 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.112 1996-12-13 12:28:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.113 1997-01-02 14:04:53 cg Exp $'
 ! !
 Method initialize!