modelica / ModelicaSpecification

Specification of the Modelica Language
https://specification.modelica.org
Creative Commons Attribution Share Alike 4.0 International
98 stars 42 forks source link

Enable an assert just once #3553

Open PYF-FR opened 1 month ago

PYF-FR commented 1 month ago

As explain here, https://stackoverflow.com/q/78695608/26398063 The assert function behaves differently when called within a function. It could be nice to add a new characteristic to the assert in order to use it only once even if used in a function.

It could help to reach the : "It is recommended to report the warning only once when the condition becomes false, and it is reported that the condition is no longer violated when the condition returns to true." of the specification : https://specification.modelica.org/master/equations.html#S3.SS7.p1 in 8.3.7

HansOlsson commented 1 month ago

To me this is primarily a tool-issue. The problem here is that it is difficult to keep track of whether it is the same warning or not - but I believe it can be improved.

However, you should duplicate the contents of the stackoverflow question here, since it seems the question has been removed for some reason.

PYF-FR commented 1 month ago

Hi, Thanks for having a look to my suggestion I updated the link in my first comment