﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5133	[NF] Problems with variability for impure functions	Adrian Pop	Adrian Pop	"If we change the variability of function calls to impure functions to Variability.CONTINUOUS we get some issues:
https://libraries.openmodelica.org/branches/history/newInst/2018-09-19%2006:44:44..2018-09-19%2013:07:57.html

The question is how do we fix this as these errors seems legit:
https://libraries.openmodelica.org/branches/newInst/Buildings_latest/files/Buildings_latest_Buildings.Utilities.Plotters.Examples.Scatter.err
Basically the pattern is:
{{{
  parameter T p = callToImpureFunction(constant_or_parameter);
}}}

It seems the only way to handle this is to go back to calculate the variability for the functions based on the input parameters even if they are impure and just disable function evaluation of impure functions.

The spec says:
{{{
With the prefix keyword impure it is stated that a Modelica function is impure and it is only allowed to call such a function from within:
- another function marked with the prefix impure
- a when-equation,
- a when-statement,
- pure(impureFunctionCall(…)) - which allows calling impure functions in any pure context,
- in initial equations and initial algorithms,
- in bindings for variables declared as parameter – which is seen as syntactic sugar for having a parameter with fixed=false and the binding as an initial equation [thus there is no guarantee that parameter is equal to the impure function call after initialization] – and in constructing external objects.
}}}

"	defect	closed	high	1.13.0	New Instantiation		fixed		
