expose
-- display the source code
of a procedure or the entries of a domainexpose(
f)
displays the source code of the
MuPAD procedure f
or the entries of the
domain f
.
expose(f)
f |
- | any object; typically, a procedure, a function environment, or a domain |
If f
is a procedure,
expose
returns the complete source code of f
,
of type stdlib::Exposed
(see ``Background'' below).
If f
is a function
environment, the result of applying expose
to the
first operand is returned.
If f
is a domain,
expose
returns a symbolic call to newDomain
; see below for
details.
In all other cases, expose
returns f
if it
is not overloaded.
The formatting of the output of expose
is sensitive to
the environment variable TEXTWIDTH
.
f
expose
serves to display the complete source code of a
procedure and all entries of a domain, respectively.f
is a domain, then
expose
returns a symbolic newDomain
call. The arguments of
the call are equations of the form index = value
, where
value
equals the value of f::index
.
expose
is not recursively applied to
f::index
; hence, the source code of domain methods is not
displayed.expose
returns a syntactically valid
MuPAD object, this return value is intended for screen output
only, and further processing of it is deprecated.Using expose
, you can inspect the source
code of procedures of the MuPAD library:
>> sin
sin
>> expose(%)
proc(x) name sin; local f, y; option noDebug; begin if args(0) = 0 then error("no arguments given") else ... end_proc
On the other hand, you cannot look at the source code of kernel functions:
>> expose(_plus)
builtin(817, NIL, "_plus", NIL)
When applied to a domain, expose
shows the
entries of that domain:
>> expose(DOM_INT)
newDomain("coerce" = proc DOM_INT::coerce(x) ... end, "phi" = phi, "new_extelement" = proc new_extelement(d) ... end, "new" = proc new() ... end, "D" = 0, "key" = "DOM_INT")
Applying expose
to other objects is legal
but generally useless:
>> expose(3)
3
overloading
mechanism for domain elements, a
domain method overloading expose
must handle the following
case: it will be called with zero arguments when the domain itself is
to be exposed.f
is a procedure, then
expose
returns an object of the domain stdlib::Exposed
. The only
purpose of this domain is its "print"
method; manipulating its elements
should never be necessary. Therefore it remains undocumented.expose
is now of the new type
stdlib::Exposed
if the argument is a procedure.