Open miqm opened 3 years ago
We originally planned to implement the operator this way. Unfortunately, the type information we have available is not 100% reliable and we didn't want subtle changes to expressions cause the +
operator to be compiled differently, possibly causing runtime errors. As a general rule, none of the operators are allowed to do type-directed translation. (Each operator has an unconditional 1:1 correspondence with some function.)
The solution for this would be to add a new function to the runtime that combines the behavior of concat
and add
and the bicep +
operator would compile into that always.
@majastrz and @alex-frankel do you think we can close this and label our string interpolation as a viable alternative?
I think we can leave it open. I don't think it's high priority, but I can see it eventually being added.
I wonder if this would also cover https://github.com/Azure/bicep/issues/4153#issuecomment-943361638
Is your feature request related to a problem? Please describe. To improve building strings and perhaps enable multi-line experience similar to one that is present in C#, we could use
+
sign to concatenate strings.Describe the solution you'd like Currently expression
var x = 'a' + 'b'
gives error, while it could be compiled toconcat
function.