Recently I encountered a bug in the model which was due to this Flexscript feature:
`string` values can be used in arithmetic expressions, and there are no warnings, exceptions, compilation errors, anything. `x` is silently converted to a numeric value zero. To make matter worse, integer 3 and string "3" are displayed identically in the debugger, and `x` can be a Variant.
While some programming languages (like Javascript, Powershell) do permit such code, they parse strings as numbers. The others do not permit such expressions without explicit type conversions.
I think it would be a good idea to make Flexscript type checker slightly stricter and require an explicit .toNum() conversion (or go the Javascript way). I understand that this is a breaking change, but otherwise there is absolutely no way to know if arithmetic expressions are evaluated correctly.
Relevant in FlexSim up to 21.2 Beta.
Can't find what you're looking for? Ask the community or share your knowledge.