27.6 Record Access Operations

Internally, record accesses are done using the operations listed in this section. For the records implemented in the kernel, kernel methods are provided for all these operations but otherwise it is possible to install methods for these operations for any object. This permits objects to simulate record behavior.

To save memory, records do not store a list of all component names, but only numbers identifying the components. There numbers are called RNams. GAP keeps a list of all RNams that are used and provides functions to translate RNams to strings that give the component names and vice versa.

  • NameRNam(nr) F

    returns a string representing the component name corresponding to the RNam nr.

  • RNamObj(str) F
  • RNamObj(int) F

    returns a number (the RNam) corresponding to the string str. It is also possible to pass a positive integer int in which case the decimal expansion of int is used as a string.

    gap> NameRNam(798); 
    "BravaisSupergroups"
    gap> RNamObj("blubberflutsch");
    2075
    gap> NameRNam(last);
    "blubberflutsch"
    

    The correspondence between Strings and RNams is not predetermined ab initio, but RNams are assigned to component names dynamically on a ``first come, first serve'' basis. Therefore, depending on the version of the library you are using and on the assignments done so far, the same component name may be represented by different RNams in different runs of GAP.

    The following operations are called for record accesses to arbitrary objects. If applicable methods are installed, they are called when the object is accessed as a record.

  • \.(obj,rnam) O
  • IsBound\.(obj,rnam) O
  • \.\:\=(obj,rnam) O
  • Unbind\.(obj,rnam) O

    These operations implement component access, test for element boundness, component assignment and removal of the component represented by the RNam rnam.

    The component identifier rnam is always declared as IsPosInt. [Top] [Previous] [Up] [Index]

    GAP 4 manual
    February 2000