Tinderbox v9 Icon

Type coercion, strings and numbers

From v9.5.0, when attempting to reason about the type of the result of an expression in ambiguous situations, Tinderbox examines the values passed to binary operators like "+". If a value is interpretable as a number, Tinderbox prefers the numeric interpretation to a string. The rules for “interpretable as a number” were, however, too lax, and expressions such as

"1883 – " + "1964" 

were treated as numeric because (the opening) part of the first string is a number.

Now, the string is regarded as a numeric value only if the entire string can be parsed as a number.

If ambiguity is obvious to the user, it is preferable to use intermediate attributes or typed variables in order to avoid the ambiguity entirely and to signal user intent clearly to Tinderbox.



A Tinderbox Reference File : Automating Tinderbox : Coding : Action Code : Type coercion, strings and numbers