You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
state foo:time[10]; // fixed size list of type time
state bar:int[]; // variable sized list of type int
List are treated differently in the targets. I believe C translates a list to an array. In C++, variable sized lists are translated to std::vector and fixed size lists to std::array. I am not sure what TS does, but I assume it also uses some kind of native list type.
Currently, LF only supports one dimension and it is not possible to define a matrix. Do you think we should also allow something like this?
state foo:time[10][3][8]; // fixed size matrix of type time
state bar:int[][]; // variable sized matrix of type int
state baz:time[][3][]; // mixed ??
I don't have a strong opinion about this. Extending the syntax seems simple, but it has the potential to cause some unforeseen problems down the road. Also note that the native target language types can always be used directly in (such as nested std::vector in C++). So we can write something like this:
state bar:{=std::vector<std::vector<int>>=};
But this does not work well for the time type.
The text was updated successfully, but these errors were encountered:
Yeah, if you use target types, you have to use the target type corresponding to time.
I believe the initial motivation for supporting lists came from the desire to be able to use clean list initializers for parameters, without having to surround them with {= =}. I guess using delimiters in type declarations of state variables is a little less bothersome. We could add support for higher dimensions, but I would consider this a low priority issue for now.
LF has a syntax for list types. For instance:
List are treated differently in the targets. I believe C translates a list to an array. In C++, variable sized lists are translated to
std::vector
and fixed size lists tostd::array
. I am not sure what TS does, but I assume it also uses some kind of native list type.Currently, LF only supports one dimension and it is not possible to define a matrix. Do you think we should also allow something like this?
I don't have a strong opinion about this. Extending the syntax seems simple, but it has the potential to cause some unforeseen problems down the road. Also note that the native target language types can always be used directly in (such as nested
std::vector
in C++). So we can write something like this:But this does not work well for the
time
type.The text was updated successfully, but these errors were encountered: