Hello all,
I have rewritten the macro processor from scratch on the
`macroprocessor-rewrite` branch.
This rewrite was necessary because we wanted to:
1) support user-defined functions;
2) support tuples, comprehensions, and arrays of arrays (changes that
made the code harder to understand and maintain).
NB: as Marco found during the summer school, the creation of arrays of
arrays introduced a breaking change: in Dynare 4.5 `[1:3]` resulted in
`[1,2,3]` whereas in 4.6 `[1:3]` results in `[[1,2,3]]`, that is to say
an array of an array instead of just an array.
The rewriting of the macro processor allows us to easily add more types
and other functionalities. Accordingly, I have added a boolean type and
would like to add a double type, which brings me to the point of this email.
Adding a double type introduces another potential breaking change and we
did not want to make this change without consulting you.
Currently, as the macro processor only supports integers, integer
division produces an integer. Hence, as with many typed programming
languages, `@{1/2}` is replaced by `0`. The introduction of doubles in
the macro language allows us to question if we want to maintain this
functionality, or if we would prefer to have `@{1/2}` replaced by `0.5`.
Note that to achieve the previous functionality, the user could write
`@{floor(1/2)}`, as we plan to support all C++ math functions that are
currently supported in the Dynare language.
Further note that if we decide to keep the current functionality where
`@{1/2}` is replaced by `0`, then to achieve a double result the user
would have to type `(a){1.0/2}`.
Hence, the question we wanted to ask you is what should the action of
the new macro processor be when it encounters integer division:
1) Integer output, i.e. `@{1/2}` -> `0`;
2) Double output, i.e. `@{1/2}` -> `0.5`?
Best,
Houtan