HISTORY AND ACCESS
satl’s own help lists two topics that let you look at your program’s names: satellite.access, “on by default, type/value for last instance”, and satellite.history, “off by default, record of everything”. This post shows where each stands in satellite 004. satellite.access(name) works. satellite.history(name) is not built yet, and satl refuses it. Both have switches, settings that say whether each one is on or off.
Asking about a name: satellite.access
satellite.access(name) tells you what a name is, what it holds now, and the exact code to reach into it, worked out from the name’s declaration. A line that is nothing but satellite.access(name) prints it. Anywhere else it answers the same text as a string, so satellite.console.display(satellite.access(name)) prints it too, and a program can keep it.
(satellite)
satellite.capsule satellite.main()
{
satellite.variable.number score = 10
satellite.access(score)
satellite.container.map<satellite.variable.string, satellite.container.list<satellite.variable.number>> scores = {"ann": {7, 9}, "bo": {4}}
satellite.access(scores)
satellite.return(satellite)
}score is a number
value 10
scores is a map (string -> list of numbers), 2 keys
value {"ann": {7, 9}, "bo": {4}}
scores["key"] a list of numbers, "key" a string, one of "ann", "bo"
scores["key"][n] a number, n counting from 1
scores["key"] = {1} puts a list of numbers under "key"
scores["key"].append(1) adds a number
scores.size how many keys it holds
scores.keys the keys of it, as a listFor a container it shows one line for every level you can reach, with n, m and so on standing for positions (which count from 1) and "key" for a key. Then it shows a line that fills each level, with a value of the right shape written out, and .size and .keys. Every one of those lines is real code: satl’s own tests run each line satellite.access prints, for thousands of container shapes. For an object of a spacesuit, it shows the object’s fields and their values, and the capsules you can call on it. The name must be one the line can see; anything else in the brackets is refused before the program runs. ANY CONTAINER IN ANY CONTAINER uses it on deeper shapes.
Asking about the past: satellite.history, not built yet
satellite.history(name) is refused before your program runs. satl checks the whole file first, so nothing is printed before the report.
(satellite)
satellite.capsule satellite.main()
{
satellite.variable.number score = 10
satellite.console.display(satellite.history(score))
satellite.return(satellite)
}--------------------------------------------------------------------------------
SATELLITE CRITICAL ERROR REPORT
--------------------------------------------------------------------------------
S110: LINE_NOT_UNDERSTOOD
satl(check): in satellite.main, no capsule named history
directory: ask_history.satl:6
syntax: satellite.console.display(satellite.history(score))
/\
satellite has no scenario for this line -- it is spelled in a shape the language
does not have a meaning for.
machine code 13 satl_line_not_understood -- satl exits with this.
--------------------------------------------------------------------------------The access switch
The access switch is built, and a program can read it. Its full name is satellite.library.main.arguments.access. It is a word the language owns, so it starts with satellite. It is also a row of the arguments variable, so a main that asks for that variable can read it short, as args.access. It is true unless you have turned it off.
(satellite)
satellite.capsule satellite.main(satellite.variable.arguments args)
{
satellite.console.display(satellite.library.main.arguments.access)
satellite.console.display(args.access)
satellite.statement.if (satellite.library.main.arguments.access)
{
satellite.console.display("access is on")
}
satellite.return(satellite)
}true
true
access is onThe switch lives in your settings file, ~/.satl/config.ini, as the row access = true or access = false. With no row, it reads true. A program can write it too: satellite.library.main.arguments.access = satellite.bool.false rewrites that row and leaves every other line of the file as it was. Only satellite.bool.true and satellite.bool.false are accepted. Writing it is a lasting change to your settings, not just to one run.
The switch is for a store that is not built yet: the last value of every name, kept so you could ask about it after the program has stopped. Until that store exists, the switch changes nothing, and satellite.access(name) works whatever it says.
The history switch
History’s switch is a row in the same file, history = true or history = false. A missing row means false. A program cannot read or write it yet: reading satellite.library.main.arguments.history stops with “there is no value here to work with”, and writing it is refused before the program runs.
satl –rebuild and the feature register
What satl acts on when it starts is not those rows but one line in the same file that sums up every switch, features = b.... satl --rebuild writes that line from the rows. Run it after you change a switch by hand:
satl --rebuildIt prints a table of every switch, whether it is on, and whether it is built yet. With access = true and history = true in config.ini, it prints, among its other lines:
bit feature state built what it does
--- ------------------- -------- ----- ------------------------------------
0 access ON yes keep the last known name, type and value of everything
1 history ON NO write every value a name ever held to disk
turned on but NOT BUILT YET, so nothing will happen:
historyThe “yes” beside access means the switch itself is built; the store it will turn on is not. If you change a row and forget to run satl --rebuild, every run prints a notice, S011 REGISTER_IS_STALE, and keeps using the old line until you do. Nothing breaks: it is a reminder.
Where next
The FULL REFERENCE marks what is built and what is not. The arguments variable, which carries the access switch as a row, is in THE ARGUMENTS VARIABLE, and help on any part of the language is in THE HELP SYSTEM.
