Skip to content

SpecificationXII · Library

12.1

How the library is organised

The library is the set of functions the language brings: each has a fixed identity, a name in each profile and a signature that does not change with the language.

Markdown version

12.1.1 How it works

There are two kinds of symbols:

  • built-in functions, called by name: length(t), sqrt(x), parseJson(text);
  • operations, called on a receiver with a dot: console.writeError(text), date.isoFormat().

Every symbol belongs to a family: text, bytes, numbers, collections, input and output, time, JSON, network or tasks. Appendix D lists them all.

Figure 12.1-1.The library families. Those on the left compute; those on the right need a host capability.

Two columns. On the left, the families that only compute: text, numbers, collections, JSON and bytes. On the right, those that need a capability: input and output, time, network and tasks.

A symbol has a single identity: its Spanish name, its English name and its aliases name the same thing with the same signature. ConvertirANumero is an alias of AReal:

ProgramTwo names, one function

Algorithm Alias
  Write toReal("2.5"), " ", toReal("2.5");
EndAlgorithm

Output

2.5 2.5

The program finishes normally.

No library name matches a reserved word, and library names are not reserved: a subprogram of your own with the same name hides the built-in one throughout the text.

Since every symbol has its own identity, a project can mix modules written in different profiles: an English module calling length and a Spanish one calling Longitud use the same function.

In short

  • Built-in functions by name; operations on a receiver.
  • Every symbol has an identity, names in both profiles and aliases.
  • The input, output, time and network families need capabilities.