Open cmnrd opened 4 years ago
In the C target, the time type is instant_t
or interval_t
. You can use these inside {= ... =}
.
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.