Preprocessor: Allow reusage of model local variable names in steady_state_model block (wishlist)
At present, variables with the same name as model local variables cannot be created in the steady_state_model
block. It would be very nice if the preprocessor to a C style approach to variable scope, and allowed the creation of variables with the same name in different blocks, when neither block contains the other. An example of quite why this would be useful follows:
An operation I find myself performing frequently is replacing e.g. the endogenous variable Y
with the endogenous variable log_Y
. I then create a model local variable for Y
via #Y = exp( log_Y );
. Ideally, I should just have to add the line log_Y = log( Y );
to the end of the steady_state_model
block for the new .mod
file to run. However, just doing this produces an error since I'm now using Y
as a temporary variable within the steady_state_model
block. Thus I have to make assorted modifications to the steady_state_model
block to first remove all references to Y
.
For an example of this in practice, see example.mod
in https://github.com/tholden/DynareTransformationEngine , which is a repository for making such transformations automatically, chiefly produced as an example of what is possible with the preprocessor. This runs at present, but doesn't if you remove the suffix underscores from the steady_state_model
block.