Topic: APLX Help : Help on APL language : System Methods : ⎕DESC Describe members
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

⎕DESC Describe public members


Implemented for Internal, External and System classes.

Syntax:

    namelist ← objref.⎕DESC N
    namelist ← classref.⎕DESC N
    namelist ← ⎕DESC N       (Within user-defined method, same as ⎕THIS.⎕DESC N)

⎕DESC is similar to ⎕NL in that it returns a list of the public members of a class as a character matrix. However, it also provides additional information about the parameters of each method, including type information if appropriate. It is especially useful for strongly-typed architectures such as Java and .Net. It can be used as a method either of a class, or of an instance of a class.

The right argument is a scalar or vector which indicates which types of class member should be included in the result, using the same codes as ⎕NL:

Code Type of member
2 Properties
3 Function methods
4 Operator methods
8 Events
10 Constructors

For Internal classes, ⎕DESC returns just the names for properties, and the function header (excluding the localised names) for function and operator methods:

Point {
  X
  Y

  ∇R←MAG
    R←((X*2)+(Y*2))*0.5
  ∇
}   
      Point.⎕DESC 2      ⍝ Applied to a class
X
Y
      PT←⎕NEW 'Point'
      PT.⎕DESC 2 3       ⍝ Applied to an object (properties and methods)
R←MAG
X
Y

For External classes in Java or .Net, ⎕DESC shows the types of properties, method parameters, and results. Because a given method name may be overloaded (i.e. exist in different forms, according to the number and types of parameters provided to it), a given method name may appear more than once:

      NetPT←'.net' ⎕NEW 'System.Drawing.Point'

      NetPT.⎕DESC 2      ⍝ Properties
System.Drawing.Point Empty
Boolean IsEmpty
Int32 X
Int32 Y

      NetPT.⎕DESC 10     ⍝ Constructors (overloaded)
Void Point(Int32, Int32)
Void Point(System.Drawing.Size)
Void Point(Int32)

      NetPT.⎕DESC 3      ⍝ Methods
System.Drawing.Point Add(System.Drawing.Point, System.Drawing.Size)
System.Drawing.Point Ceiling(System.Drawing.PointF)
Boolean Equals(System.Object)
Boolean get_IsEmpty()
Int32 get_X()
Int32 get_Y()
Int32 GetHashCode()
System.Type GetType()
Void Offset(Int32, Int32)
Void Offset(System.Drawing.Point)
System.Drawing.Point op_Addition(System.Drawing.Point, System.Drawing.Size)
Boolean op_Equality(System.Drawing.Point, System.Drawing.Point)
System.Drawing.Size op_Explicit(System.Drawing.Point)                 
System.Drawing.PointF op_Implicit(System.Drawing.Point)
Boolean op_Inequality(System.Drawing.Point, System.Drawing.Point)
System.Drawing.Point op_Subtraction(System.Drawing.Point, System.Drawing.Size)
System.Drawing.Point Round(System.Drawing.PointF)
Void set_X(Int32)
Void set_Y(Int32)
System.Drawing.Point Subtract(System.Drawing.Point, System.Drawing.Size)
System.String ToString()
System.Drawing.Point Truncate(System.Drawing.PointF)

For the R interface, ⎕DESC can be used to produce a list of all the R functions which are available in the currently-loaded packages, together with the parameters and default values (except for primitive functions). This will usually be a large list (several thousand functions):

      r←'r' ⎕new 'r'
      fns←r.⎕desc 3
      ⍴fns
2037 117 
      fns[1445+⍳5;]
pwilcox (q, m, n, lower.tail = TRUE, log.p = FALSE)
q (save = "default", status = 0, runLast = TRUE)
qbeta (p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)
qbinom (p, size, prob, lower.tail = TRUE, log.p = FALSE)
qbirthday (prob = 0.5, classes = 365, coincident = 2)

Topic: APLX Help : Help on APL language : System Methods : ⎕DESC Describe members
[ Previous | Next | Contents | Index | APL Home ]