methodsOf
|
The methodsOf function returns the Methods Structure for a the specified class object {class}. The Methods Structure exists for all class Structures and class Lambdas. It contains method bindings, which are the
method name, and the Lambda that is associated with the method. The
Methods Structure is updated any time a defmethod macro is invoked. For instance below we define a class Lambda, create an object of the class, and then
use the methodsOf function to return the class methods. Usage Since the methodsOf function returns the Methods Structure
object, it is usually used in conjunction with other functions to
retrieve the information about the class Methods. The length
function will determine how many methods exist for the class. The
isMember function will determine if the specified method is
in the Methods Structure.
(defclass employee()
svars:(String:Name (Number:Salary 0.0))
cvars:(empStatic)
(defun new(self name salary)
(setq Name (string name))
(setq Salary salary)
self) ;; end of new method
(defun talk(self)
(writeln "I " Name " am an employee.")
true) ;; end of talk method
;;.... other class methods here
true) ;; end of employee class
(defclass employee:manager()
svars:(String:Title)
(defun talk(self)
(writeln "I " Name " am a manager.")
true) ;; end of talk method
;;.... other class methods here
true) ;; end of manager class
;; Finding the class name of an object created by a class Lambda
(setq emp (new employee "John Doe" 24000.0)) ;; Create an object of class employee
(setq mgr (new manager "Chuck Bigman" 36000.0)) ;; Create an object of class manager
;; Finding the class methods of an object.
(refAttributed (methodsOf emp)) ;; returns #(obj| new talk )
((methodsOf mgr)[talk:] mgr) ;; writes on the console, "I Chuck Bigman am a manager."
(methodsOf object) The Methods Structure for that object
Expression:
Arguments
Name
Type
Description Argument: object Structure or Lambdal
Must be a class Structure or a class Lambda
Returns:
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
Symbol | Dictionary | ObjectRepository |
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
|