WaterDoc: thing
Contract <thing rest="all" other_named_args=true />
Subclasses!DOCTYPE, ?xml, Example, access_rights, active_value, active_value_record, argument, boolean, char, color, container_hierarchy, data_path, datetime, datetime_interval, db_resource, defclass, defmethod, deprecation, diff, doc, docs, duration, eof, expr, field, field_doc, filesystem, global_args, group, hypertext, ide, thing, of, interface, java, java_constructor, java_method, java_object, number, output, pattern, request_or_response, result_set, return, server, short_line, smart_vector, string, symbol, syntax_error, system, target, test, tests, type, vector, web, xml_style, xmlns
Methodsand, append, apply, object_less, assert, cache_instance, call, call_start, combine, concat, container_of, convert_database_strings_into_real_water_objects, copy, copy_aux, copy_down_data, copy_down_field_order, count, create_and_insert_using_path, create_jnlp_file_for_water_program, data, object_more, display, display_aux, do, echo, equal, error, execute, execute_expr, execute_path, execute_string, field_key, filter, for_each, force_ek_code, format_attributes, format_tag, from, get, get_doc, get_from_path, get_java_class, get_java_class_field_value, get_java_method, get_parents, get_tests, get_type, get_type_checking, get_value, get_with_value, group_heading, has, has_no_attr, has_one_value_in_content, has_start, has_subject, hist, html_columns, html_large, html_large_for_thing, html_medium, html_rows, html_small, html_large, if, if_missing_create_class, iip, increment, init, insert, inspect, is, is_a, is_active_value, is_attr_a_field_key, is_content_a_vector_of_instances, is_content_empty, is_content_of_field_elements, is_defclass_in_container, is_defmethod_in_container, is_field_content_the_value, is_not, is_settable, is_sorted, is_type_for, join, key_of, keys, last, length, lookup_with_limit, make_def_doc_string, make_empty_cached_instances, make_object, meta_key, non_meta_key, non_regular_key, non_string_key, non_system_key, non_vector_key, normalize, normalize_attributes, not, object_less, object_more, open_browser_window, or, pad_digit, parent_init, primary_value, print, promote_object, quote_as_string, random_field_key, random_field_value, random_instance, record_vector, regular_key, remote_request, remove, rename, rename_field, replace, replace_circ_refs, return_false, return_subject, return_true, reverse, set, set_field, set_java_class_field_value, set_namespace_aliases, set_type_checking, set_value, sort, sql, stack_report, string_key, string_to_java_class, subvector, subvectors, system_key, to_concise_xml, to_concise_xml_for_view, to_concise_xml_top, to_csv, to_csv_top, to_doc_top, to_h2o, to_concise_xml_top, to_html_top, to_html, to_html_attr, to_html_for_view, to_html_top, to_javascript, to_js_top, to_numbers, to_object, to_path, to_path_of_objects, to_plain_text, to_primitive, to_soap, to_soap_top, to_string, to_string_for_view, to_txt_top, to_uri, to_xls_top, to_xml, docs, to_xml_root, to_xml_top, try, union, vector_key, view, warning, wrap_with_html_comment
thing is the top level object in the object system. It can be referred to in code as thing. All objects have as an ancestor, thing, except for thing itself which has no parents. If you want to make an object and you don't care what its parent is, use thing.
Example:
<thing color="purple" size=12/>
This executes to an object whose parent is thing. It has two additional fields, a field named "color" with a value of the string "purple" and a field named "size" with the value of the integer 12.
Using <thing color="purple"/> we create an object that has a field whose name is the string "color" and whose value is the string "purple". But a field name can be any object. This object creating syntax permits integers to be field names:
Example: <thing 0=10.<plus 123/>/>.0 result=133
Example: <thing 3=10.<plus 124/>/>.3 result=134
Floats can also be names of fields.
Example:
<thing 1.2=3.<plus 4/>/>.<get 1.2/>
result=7
Note that dot is used for both floating point numbers and getting the value of a field. This is unfortunate since it makes dot confusing, but the alternatives weren't very good either. This is the same as for Java and JavaScript, by the way, but neither of those can have fields with names of floats so we have to be careful. We can't say foo.1.2 and expect to get the field named 1.2 within foo because instead we'd be asking for the field named 1 in foo and then asking for the field named 2 within THAT. However, we can use get to execute the name of the field whose value we are asking for. Since numbers execute to themselves, then foo.<get 1.2/> will get the field named 1.2 in the foo object.
Calling thing allows you to create fields of any name. If you want to name the fields by consecutive integers starting with zero, you can because thing accepts "rest" arguments. So an instance of thing (or most other objects) can behave like a vector:
Example: <thing 100 101 102/>.1 result=101
Example:
<thing 100 101 102/>.<insert 103/>.3
result=103
Example:
<thing color="orange" 11 22/>.color
result="orange"
Example:
<thing color="orange" 11 22/>.1
result=22