Replies: 1 comment
-
As far as I'm aware we don't force everything to be strings, but at points where we expect a number we are assuming that it the variable could be a number or string so are doing the parsing needed to ensure it gets handled correctly. I am on board with adding type information to variables, this is a small portion of a pitch I wrote for overhauling variables #1187 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can we start a discussion wether we need or want to type variables.
Today variables and the result of an expression are loose typed like javascript variables. For the user all variables are strings, numbers are passed as strings and typecasted at various locations.
Would it be good to allow variables to be declared as e.g.:
If yes, we could also give more metadata to variables, like a maximum and minimum value for a number and then Companion could make sure that the variable never exceeds the range. Typecasting could still work as automatic as possible and be even better than today because we then explicitly know the destination type.
Especially I think we need a way to expose arrays to the users. In my work with Companion I regulary find myself confronted with repeating tasks of generating dozens of indexed variables and using nested name constructions to address them. So I think when we introduce arrays, maybe it is a good idea to type all variables at the same go.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions