Representing text in PCE
PCE has various primitives to represent text. These are names
(atoms), strings and text_buffers. Which of them is most suitable
depends on the operations that are needed.
- NAME
- Names are like atoms in Prolog. They are internally passed and
manipulated as identifiers into a name-table. These identifiers are
unique: the same identifier guarantees the same name and different
identifiers garantees different names.
Names cannot be changed and the memory they use is never reclaimed.
Names are a suitable representation for IDENTIFIERS.
- STRING
- A string is an object that represents a sequence of ASCII values.
Strings can be manipulated, but changing a string will often cause a
reallocation in memory and a copy, making them not suitable for long
texts that are often manipulated.
Strings are often used to store descriptions and not-too-often
changing texts.
- TEXT_BUFFER
- A text_buffer is used to store the text manipulated by an editor.
Text_buffers are designed to deal with long texts and changes. They are
rarely used disjoint from an editor.
Parent: Data Representation
- See also
- - class text_buffer
- class string