1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
--- status: Rewritten August 2020
--- author(s): Mahrud
--- notes: functions below are all defined in packages.m2
doc ///
Node
Key
export
(export, List)
(export, String)
Headline
export symbols from a package
Usage
export {"symbol1", "symbol2", ...}
Inputs
:List
containing strings or options with string keys and values belonging to the package
Outputs
:List
the list of exported symbols
Consequences
Item
the symbols whose names are in the list as strings, which should refer to functions or other symbols
defined in the package, are made available to the user of the package, and are marked non-mutable.
The strings are converted to symbols with those names in the dictionary of the package.
An option of the form @TT "\"name\" => \"symbol\""@ creates a symbol with the name @TT "name"@
that is a synonym of the symbol @TT "symbol"@.
Description
Text
A package can contain the code for many functions, only some of which should be made visible to
the user. The function @TT "export"@ allows one to specify which symbols are to be made visible.
For an example see @TO "an example of a package"@.
No single-letter symbol should be exported, since such symbols are reserved as variables for the user.
Use @TO exportMutable@ to export symbols whose values the user is permitted to modify.
Use @TO importFrom@ to import private symbols of a package.
SeeAlso
exportFrom
exportMutable
importFrom
Node
Key
exportMutable
(exportMutable, List)
(exportMutable, String)
Headline
export mutable symbols from a package
Usage
exportMutable {"symbol1", "symbol2", ...}
Inputs
:List
containing strings interpreted as names of symbols belonging to the package
Outputs
:List
the list of exported symbols
Consequences
Item
the names of symbols in the sequence, which should refer to variables defined in the package, are
made available to the user of the package, in such a way that their values may be modified by the
user This function is needed much less frequently than @TO export@.
For an example, see @TO "an example of a package"@.
No single-letter symbol should be exported, as such symbols are reserved as variables for the user.
Use @TO importFrom@ to import private symbols of a package.
SeeAlso
export
Node
Key
exportFrom
(exportFrom, Package, List)
(exportFrom, String, List)
(exportFrom, Package, String)
(exportFrom, String, String)
Headline
export symbols from a package's private dictionary
Usage
exportFrom(pkg, {"symbol1", "symbol2"})
Inputs
pkg:{Package,String}
the package containing the symbols
:{String, List}
of strings, corresponding to the symbols to export
Consequences
Item
package symbols provided in the list will be added to the @TO2 {Dictionary, "dictionary"}@
of the @TO2 {"currentPackage", "current package"}@, and will be exported
Description
Text
This function can be used to export specific symbols from the private dictionary of another package.
Example
exportFrom_Core {"HTML"}
SeeAlso
export
importFrom
Dictionary
Node
Key
importFrom
(importFrom, Package, List)
(importFrom, String, List)
(importFrom, Package, String)
(importFrom, String, String)
Headline
import symbols to the current private dictionary
Usage
importFrom(pkg, {"symbol1", "symbol2"})
Inputs
pkg:{Package,String}
the package containing the private symbols
:{String, List}
of strings, corresponding to the private @TO2 {Symbol, "symbols"}@ to export from the package
Outputs
:List
of @TO2 {Symbol, "symbols"}@
Consequences
Item
package symbols provided in the list will be added to the private @TO2 {Dictionary, "dictionary"}@
of the @TO2 {"currentPackage", "current package"}@, but will not be exported
Description
Text
This function can be used to import specific symbols from the private dictionary of another package
into the private dictionary of the @TO2 {"currentPackage", "current package"}@.
Example
importFrom_Core {"raw"}
raw random(ZZ^2, ZZ^2)
Text
To import all private symbols of a package, use @TO (debug, Package)@ instead.
The symbols imported with this function can then be exported using @TO export@ or @TO exportMutable@.
SeeAlso
(debug, Package)
exportFrom
Dictionary
///
|