Request for JS Concat

Hi Team,

I’m not sure of the best place to submit feature requests. Should they be posted here, on the GitHub Issues page, or somewhere else?

We’ve recently discovered a bug in our experiment code that resulted in incorrect data being recorded. As part of our analysis workflow, we were calculating a standard deviation and needed to combine two lists. Because of the Auto->JS translation, the code ran without error, but the lists were joined using JavaScript’s + operator behaviour rather than Python list concatenation. As a result, two adjacent values were merged together, producing invalid output and ultimately affecting our results.

Wakefield has kindly put together a guide explaining this behaviour and how to avoid it. However, I wondered whether this could be addressed directly in the Auto->JS translation process.

Would it be possible for expressions such as:

Python

  • list1 + list2

to be translated to:

JavaScript

  • list1.concat(list2)

rather than:

JavaScript

  • list1 + list2

This would more closely match Python’s behaviour for list concatenation and could help prevent subtle data-processing bugs that are difficult to detect until much later in the analysis pipeline.

I appreciate there may be technical reasons why this isn’t straightforward, but I thought it would be worth raising as a potential improvement.

Thanks!

The main reason why this isn’t straightforward is because you are asking for a + b to translate to different things depending on what a and b actually are. This may not be obvious from the code, and could change at any moment. I would recommend having a custom function defined in a Both component so it works the same way in both environments.