Open modelica-trac-importer opened 6 years ago
Reopening, since I think this shows that the wording available in all models and blocks needs to be removed.
Reopening, since I think this shows that the wording available in all models and blocks needs to be removed.
I don't see that we can just remove that; we could replace it by something else. I could see that we add the second sentence below:
The variable is a built-in variable available in all models and blocks, which is treated as an input variable. The name time is reserved and may not declared in any class.
Sounds good.
To me, it would make a lot of sense to give it keyword status, instead of ending up with the same sad situation as with Real
and friends: things which are like keywords in every way except that the specification fails to give them full keyword status.
For example, things like this are trivially avoided if giving full keyword status:
type E = enumeration(one, more, time);
Yes, having it as keyword would be best - because it doesn't fully work to view it as a variable.
Fully explanation: See https://github.com/modelica/ModelicaSpecification/pull/3090/files - that implies that each use time
is sort of a separate variable. That was needed to fulfil the promise for clocked discretized partitions that any model can be discretized, so time
in one such model can be clocked even though time
in another partition is continuous. Normally the partitions are different model, but if you flatten the structure the same is needed in one model so it doesn't suffice to view time in different models as different variables - it must be each use of time, i.e., it is better to view it as a keyword and not a variable.
Reported by perost on 13 Aug 2013 09:22 UTC Is the built-in variable time allowed to be shadowed by another element? I.e. can you declare an element with the name time? The specification (3.6.7) only says that time is a built-in variable available in all models and blocks, which doesn't preclude declaring a local element with the name time. Allowing time to be shadowed causes some ambiguity though:
Migrated-From: https://trac.modelica.org/Modelica/ticket/1243