Clarify the use of the "constant" attribute. #132
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a Variable object is set to constant, this is now meant to have the intuitive meaning: The values stored do not change during a run (a code generation target could use this for optimizations). Only AttributeVariable objects that are non-constant are updated in the namespace at every timestep (and this will be probably removed in the long term, the only current use case is the
t
of the clock and this may well be handled with a specific solution). There's a new attributeconstant_size
forDynamicArrayVariable
, stating whether the size of the array can change during a run (e.g. in monitors), this is necessary to update the reference to the underlying array.There's still one inefficiency here: The reference to the underlying array is never actually used in the case of monitors, so we wouldn't necessarily need to update the reference. I think -- as we discussed earlier -- we should probably make clear for code whether it only reads from dynamic arrays (e.g. synaptic updates) or only writes to them (e.g. monitors).
Ready to merge from my side for this smallish change, only in case travis does not disagree of course ;)