fuselibs
fuselibs copied to clipboard
UX uses `Add` to handle string concatenation, cannot sequence numbers
In a string expression, such as <Text Value="{a}-{b}"> the UX compiler emits Fuse.Reactive.Add expressions instead of a Concat operation. This requires that Add in fuselibs have special handling that if either is a string, then they are both forced to strings and converted. This is the wrong place to do this detection.
I believe that if https://github.com/fusetools/fuselibs-public/issues/839 is fixed, this would also mean the following code would not work correctly:
<App>
<Let ux:Name="a" Value="{= 1 }"/>
<Let ux:Name="b" Value="{= 2 }"/>
<Text Value="{a}{b}"/>
</App>
I suspect this would reuslt in 3 rather than 12, as the fuselibs function will see too numeric values (neither a string), and thus add them. The function Add has no way of knowing it's meant to do concatenation.
A Concat operation should be added and the UX changed to emit that for string concatenation.
PR https://github.com/fusetools/fuselibs-public/pull/898 adds the Concat operator and uses it explicitly as a workaround. The UX compiler should be able to emit that instead.