[Next] [Up] [Previous]

The XOPR Statement

The XOPR statement resembles the OPERATOR statement in syntax, but it contains no variable names. Also, operands, as opposed to arguments in operator/functions, cannot have the types EQUATE, LIST_EQUATE or VLIST_EQUATE. The type TEXT is allowed, since each operand of an operator can be delimited using priority rules no matter what actually is done with the operand, but behaviour with respect to leading and trailing spaces is undefined as far as whether they will be retained or discarded. For the same reason, the types EXPRESSION and VLIST_GEN are allowed for operands, but it is preferable to leave these argument types for use within functions.

In addition to elements allowed in the OPERATOR statement, and additional options as found in XSUB, XFUN, and XLFN, an XOPR statement can also contain an indication of operator priority. Thus, the form of an XOPR statement is:

       XOPR (result-type) = (opnd1-type) &.op-name. (opnd2-type) ;
            dyadic-priority: right-hand-dyadic-priority;
            prefix-priority; postfix-priority

or, op-name can be followed by an additional period and an argument list in the same form as for XFUN, XSUB, and XLFN.

The default priority is 95; where dyadic-priority is given, it becomes the default for the other priorities if they are omitted. Note the colon following dyadic-priority; it is possible to specify different priorities for the right and left sides of an operator, but, since it is more usual to specify the same priority for both, when this is done, it is not necessary to omit an argument in the list to specify the prefix-priority, which is the next major item that can be specified.


[Next] [Up] [Previous]