Tinderbox v9 Icon

Argument expected data type

Data type: what Tinderbox 'data type' is needed by an argument or its target operator?

Whether explicit in the argument name or not, most argument will have a documented or implicit data type. This worth bearing in mind especially when passing attribute values or variables as the argument value.

If the source data type is incorrect, it might be necessary for Tinderbox to 'coerce' the data from one form to another at which result in an unexpected outcome. In programming, when software makes one kind of data into another, e.g. makes a string of digits into a number, that precess is called 'coercion'.

Experienced users will likely know where this might occur and act accordingly. New users are advised to avoid coercion, which might have unexpected results, by first formatting their data to the desired type and only then pass the result as the argument. For example, if a function is looking to receive a numerical argument do not give it a quoted string of digits such as "12345" but the numerical value 12345. Practice and experience will soon help this become clear.

Another aspect to this is knowing the data type upon which the operators work (without implied coercion). For instance, there are a suite of dot-operators that work only on Color data-type, or only on Date data-type, etc. Thus, even if the arguments do not stipulate a data type, be aware of the data type being passed into, or literally written as, the argument' value.

Another aspect of the data type is the likely range of acceptable vales, which may not be explicitly stated. For example, a number of opacity-related system attributes use a number representing a percentage between 0% (value: 0) and 100% (value: 1). Using 10 (100%) instead of 0.1 (10%) when intending to indicate '10%' may confuse Tinderbox. Even if it treats a value of greater than 1 as 1, that will result in an opacity 10 times that expected. Where value range limits are known, they will be documented.

Failure to take account of data type when passing argument values is likely to result in unexpected results or silent failure—no results and no explanation or indication as to why. Should he latter occur, checking the argument values is a good place to start looking for an explanation.