$g is the logical name for #349, the Game Utilities object, which is a child of the Generic Utilities Package(#79).
$g is the standard place for storing utilities relevant to a particular virtual environment, but that are not part of the standard distribution of utilities that come preloaded into the LambdaCore database (e.g. $string_utils, $list_utils, $command_utils, $object_utils, $time_utils, etc.). In general, though, only wizards will create utilities and save them on $g.
As an example, the accessor functions
More importantly, $g also provides a good way for programmers to create and use symbolic names (and avoid object numbers in code).
The most common way for programmers to use this utilities package is to define a property on $g, and assign it a frequently used object.
For example, if you were creating a member function machine (object #1722, say) for demonstrating how the member function operates, and you will need to refer to the Member Function Room's (#1717) contents in your code, you could write
but a far better method would be to add a member_function_room property to the Game Utilities(#349) object, $g, and then reference the contents of your function room like so:
This works because
If you owned $g you could add properties like this
But the wizard owns $g, so you must use the accessor function, like so:
The following are already defined on $g. You demo machine is probably on this list. If not, use add_dollarg_prop to add it.
Member_Machine: #1722 symbolp_machine: #1737 get_machine: #1741 null_machine: #1758 PLUSP_machine: #1778 car_cdr_machine: #1784 Concatenate_Machine: #1791 plus_or_minus_1: #1792 max_and_min_machine: #1801 remprop_machine: #1814 sublis_machine: #1750 Comparison_on_Numbers_Machine: #1829 Subseq_Function_Machine: #1854 equal_machine: #1887 plus_and_minus_operation_machine: #1890 inc_and_dec_machine: #1907 cons_machine: #1923 machine_box: #1925 MINUSP_machine: #1893 gensym_machine: #1958 Abs_machine: #1965 Random_Machine: #1968 listp_machine: #1970 dolist_machine: #1918 char_equal_machine: #2003 nth_machine: #1763 Cadr/Cdar_machine: #1862 floor_machine: #1839 mod_machine: #2046 butlast_machine: #2048 exp_expt_machine: #1805 LIST_function_machine: #2050 Length_Machine: #2051 sqrt_machine: #2052 arithmetic_machine: #2056 alphanumericp_machine: #2067 intersection_machine: #2077 union_machine: #2078 Trigonometric_Functions_Machine: #1754 float_machine: #2006 Association_Function_Machine: #1728 count_machine: #1730 Position_Machine: #2071 merge_machine: #1892 reverse_machine: #2062 eq_and_eql_machine: #1819 equal_and_equalp_machine: #1887 member_function_room: #1717