Strange typing behaviour in the X# macro compiler
Posted: Wed May 21, 2025 2:55 pm
Hi all,
We have an application ported from VO that heavily relies on macro execution, and we discovered the following behaviour in the macro engine when evaluating expressions:
As it turns out, mixing a dword (unsigned int) with a signed integer will make the macro engine flip to Int64 for the entire expression. This gave us quite the headache as our application could not handle numeric usuals suddenly going Int64.
Is this a bug, or is it done on purpose to prevent overflows? Note that the X# compiler itself does NOT do this, it only happens when executing a macro. We are on X# version 2.21.
We have an application ported from VO that heavily relies on macro execution, and we discovered the following behaviour in the macro engine when evaluating expressions:
Code: Select all
local xMonth as usual
xMonth := MExec(MCompile("Month(Today())"))
// Result: xMonth contains Long (Int32)
xMonth := MExec(MCompile("Month(Today()) + 1"))
// Result: xMonth contains Int64, UsualType(xMonth) is 22!
// General examples
UsualType(MExec(MCompile("3 + 1"))) // Int32
UsualType(MExec(MCompile("3u + 1u"))) // still Int32
UsualType(MExec(MCompile("3u + 1"))) // Int64 !!
Is this a bug, or is it done on purpose to prevent overflows? Note that the X# compiler itself does NOT do this, it only happens when executing a macro. We are on X# version 2.21.