eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Method::MethodWhoInfo':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: MethodWhoInfo (private in Method

This class is only visible from within Method.

Inheritance:

   Object
   |
   +--Method::MethodWhoInfo

Package:
stx:libbasic
Category:
Kernel-Methods
Owner:
Method
Author:
Claus Gittinger

Description:


In earlier times, Method>>who returned an array filled
with the method's 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.


Related information:

    Method

Class protocol:

instance creation
o  class: cls selector: sel
return a new MethodWhoInfo object;
this is a private interface for Method


Instance protocol:

accessing
o  method

o  methodClass
return the class which contains the method represented by myself

usage example(s):

     (Method compiledMethodAt:#who) who methodClass
     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass

o  methodSelector
return the selector under which the the method represented by myself
is found in the class

compatibility
o  at: index
simulate the old behavior (when Method>>who returned an array)

private-accessing
o  class: cls selector: sel



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 25 Apr 2024 06:30:24 GMT