MarekMatejak / Physiolibrary

Modelica library for Physiology
BSD 3-Clause "New" or "Revised" License
32 stars 18 forks source link

Some non-standard syntax has been used in the library #33

Closed adrpo closed 3 years ago

adrpo commented 3 years ago

It seems that Dymola gives us more work by supporting non (yet) standard syntax (expression)[index]. This is not yet even allowed in Modelica spec 3.5, see: https://github.com/modelica/ModelicaSpecification/issues/2659 See also #32

MarekMatejak commented 3 years ago

There is a problem. I just realized that Dymola 2021x automatically rewrite these expression from MMb[1:nS-1] . sV[1:nS-1] to (MMb.sV)[1:nS-1])

So I apologize if it occurs anytime in future commit. It will be hard to guard it.

adrpo commented 3 years ago

Ok. Thanks for the heads up. We have another strategy to handle this in OpenModelica, support it and warn about it. We'll find a way.

sjoelund commented 3 years ago

You could add a CI check to parse the library using OpenModelica or moparser to prevent illegal syntax from being added (if you use pull requests). Or a precommit hook in git that tries to parse using one of the tools. Then you get an early error :)

MarekMatejak commented 3 years ago

Can I call you to learn how to "add this CI check" or "precommit hook". Or is it somewhere described?

sjoelund commented 3 years ago

https://github.com/features/actions https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

I can probably write some short example for a Github action (didn't try it myself since we setup or CI/CD a long time ago)

MarekMatejak commented 3 years ago

It looks good. Thank you Martin.