cwal

whcl: info Builtin Command
Login

whcl: info Builtin Command

(⬑Table of Contents) (builtins)

Querying info About Values and Variables

The info builtin command is for querying all sorts of properties about variables and values.

Usage: info [args] (some queries need an argument, some don't)

The current tags are listed in full below but first a description of their naming conventions is in order. The tags are all lower-case. Many start with "is-" or "has-", and both of those have similar meanings best explained with an example: Consider the is-array and has-array tags: an Array value (created via the array built-in command or the C-level cwal_new_array()) "is" an array, whereas a non-array value which includes an Array in its prototype chain "has" an array (and can be treated like one for many purposes). What makes an array an Array is really the fact that it has the C-level type ID CWAL_TYPE_ARRAY. Whether or not it behaves like an array in whcl depends largely on its prototype, where most script-visible behavior is implemented.

Type Queries

Variable State Queries

The Obligatory Misc. Category

TODO: X inherits Y, or similar. That requires adding new syntax options for the info command. It's not 100% clear how we might implement this under whcl class inheritance model, other than to see if X has Y or Y[__prototype] somewhere in X's prototype chain. The latter case would be needed for compatibility with the new command's conventions but the former makes more intuitive sense.

Iteration-related Queries

The iteration-related info queries exist to assist in determining whether it's currenly legal to iterate over an object or list or whether iteration is currently underway.

The object model of whcl's underlying scripting engine does not allow object-type properties to be iterated over in certain (rare) cirumstances, nor does it support modifying properties during iteration (because its data structures simply do not support that). Lists (array entries) may be iterated concurrently and their values modified, as doing so can be done without invaliding their internal cursors. Note that appending to an array during iteration may well cause and "endless" loop until the engine reaches its limit or all system memory is consumed.

info queries related to querying iteration-related state: