General: Fields are
Glee's way of naming and referencing "Methods and
Properties" of Objects; "Fields" of Record Sets; and
"Symbols" of Referenced Namespaces. Field names are delimited by a
leading period ( . ) in the user's namespace and a leading colon
(:) in the system namespace. The period or colon is not considered
part of the field internally ... it is a cue to the parser for typing.
Internally, fields are just specially tagged string objects. This special
tagging allows Glee to interpret the string in context rather
than as data. All Glee objects have fields. Glee's
interpretation of fields is case insensitive.
Besides the Object context, Glee's fields are important to
Namespaces and Record Sets. In References to Namespaces, Glee's
fields become references to symbols. In the Record Set context,
Glee's fields become symbolic names of fields (i.e. column
elements) in records.
Number: This example
illustrates a query ( : ) of the fields for a number object.
Number (Detail): This
example illustrates responses to various number object field queries. In order,
they are: numeric designation of alignment (float or integer), character
designation of alignment, size of the object, object as a string, object as a
verbose string, numeric designation of object type, and character designation
of object type. Note: I display the :string response by
bracketing it in verbose switches ($V $v) so you can see it is a
string.
String: The string object
currently supports standard query fields plus comma separated values
(:csv), hex representation (:hex), and conversion to numeric
(:num) methods. Methods execute an algorithm when referenced to return
their result. The other fields can be considered as properties and just return
the state of the object.
String(Detail): This
illustrates standard property displays for string object fields.
String (:num):
Converts strings to numbers. If numbers can be found in the string the result
is numeric with nil in postions of substrings failing conversion. An
empty character string results in an empty numeric vector.
String
(:csv):Representation of data as comma separated vectors (csv) is
common for transferring data between systems. If a string is really data in
csv form, this method will convert it into a sequence (lines) of
sequences (fields separated by commas). Each element is a string with the
delimiting commas removed. Quoted strings are not dequoted and strings of
numerics are not converted to numbers. Such needs are left to further
processing by the user's Glee code. It is possible, a method for
more complete conversion will be added in the future.
String (:hex):This
is a convenient vulturing tool. You can grab data and store it in a string. You
can then display portions of the string (by indexing into it) in hexadecimal
form to know exactly what it contains. The result is a string with
0x0A characters dividing the lines. Non-printable data displays as
periods.
Sequence(Detail):Notice
that the :string method here is not particularly useful as it
doesn't separate the display of the elements. The expose with separator
operator ( ,, ) can be used to obtain string displays of sequences
with any desired separator. Note: A sequence is just a vector of 8 byte
pointers. Therefore, its size does not reflect the size of the objects to which
its elements point.
Namespace: Namespaces
contain considerable valuable information. Properties like :names, :size,
:sizes, :string, :stringv, :typec, :typen, :values allow us to take a look
at it. The :clear method clears the namespace of all its references.
Namespace([]:clear=>@): The empty index
to no object ([]) defaults to the current namespace. Thus,
[]:clear operates on a copy of the current namespace and clears all
objects from it. You can selectively remove objects from a namespace using the
( ~ ) without operator.
Namespace: Namespaces
contain considerable valuable information. Fields allow us to take a look at
it. The :clear method clears the namespace of all its references.
.names yields the names of symbols a namespace contains.
Namespace property
examples:This example gives a play-by-play description of the various
namespace fields. Being interested in the most local namespace, I use the
@ reference operator to obtain a reference to it. First, I clear the
most local namespace with (#ns =>@). You may also use
(#NS=>@) to accomplish this. I then put three objects (i,s, and k)
into the namespace by assigned them values. The indexing operator ( []
) with no left argument assumes the most local namespace and returns all its
elements (as any empty index will do).
The : field queries. @ : then queries the local
namespace for its properties and methods. It yields (:, :clear, :names,
:size, :sizes, :string, :stringv, :typec, :typen, :values) which are all
the current fields (i.e. methods and properties) exhibited by namespaces.
Next I display the size of the namespace ([]:size ).
Glee goes through all namespace objects to compute this value.
The (:typec and :typen) properties tell the object type.
(:names, :sizes, and :values) return detail information about
namespace objects. Note, these are all in namespace order which is alphabetic
by name (ignoring case). Also note the (,,) "expose with
separator" operator after the :name example that spaces out the
names. Finally, string representations of namespace names are obtained using
(:string and :stringv).