Expressions can auto-convert types or strictly honour data types
By default, any arithmetic expression on values that look like numbers will proceed to treat those values as numbers even if their underlying data type is not numeric. This can be illustrated with the following example:
» 1 + "2"
3
This is useful because shell processing is generally operating on bytes, which often are treated as strings. Thus the OS doesn’t have any concept of a numeric verses non-numeric parameter. As far as Linux or Windows knows, all numbers are strings too. So having Murex auto-convert values reduces your day-to-day cognitive overhead when working in the shell.
Sometimes you might be writing Murex-native code and that code needs to care about type safety. For example, you might need the leading zeros retained in string when making comparisons. In situations like this, you can enable strict types via config
:
config set proc strict-types true
Using the same example from the previous section but with strict-types set to true
:
» 1 + "2"
Error in `expr` (0,1): cannot Add with string types
> Expression: 1 + "2"
> : ^
> Character : 5
> Symbol : QuoteDouble
> Value : '2'
strict-types will be scoped to that function and thus changing this option will not cause accidental side-effects in other functions.
expr
): Expressions: mathematical, string comparisons, logical operatorsconfig
): Query or define Murex runtime settingsThis document was generated from gen/user-guide/strict-types_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Wed Sep 18 21:18:57 UTC 2024 against commit c037883c03788357164e9846c84d9f777251495d9452a8e.
Current version is 6.3.4225 (develop) which has been verified against tests cases.