Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misplaced standardized annotations #3638

Open
henrikt-ma opened this issue Jan 21, 2025 · 2 comments · May be fixed by #3642
Open

Misplaced standardized annotations #3638

henrikt-ma opened this issue Jan 21, 2025 · 2 comments · May be fixed by #3642
Assignees

Comments

@henrikt-ma
Copy link
Collaborator

As far as I understand, this is a perfectly legal use of annotations:

function f
  output Real y;
external "C"
  y = myextf();
  annotation(Include = "double myextf(){ return 1.0; }");
end f;

Instead of running into a linking error, an error telling me that the Include isn't allowed in the class annotation would have been fantastic, but of course we can't make something like this illegal over night. Short of that, wouldn't it be great if the specification generally deprecated the presence of standardized annotations in places where they don't have a meaning?

Note that this is specifically about the standardized annotations. To do something similar to help the user with misspelled annotations is much harder, since we don't know the set of valid annotations without knowing the language version in use. This would be one of the applications of MCP-0015.

@HansOlsson
Copy link
Collaborator

I had always assumed annotations were only valid where defined, and thus I don't see why we cannot clarify this by adding it overnight. Dymola does detect it, since quite some time, - and no-one has complained that they don't want warnings for misplaced annotations.

I have already used the implication in a PR that we should avoid having the same name for slightly different annotations (obviously annotations with the same meaning can and should have the same name), in order to be able to detect mistakes such as the one above.

I don't see why language version is particularly important for this issue. If people are using a newer version there might, of course, be both new annotations, new functions, and even grammatical constructs.

@henrikt-ma
Copy link
Collaborator Author

I had always assumed annotations were only valid where defined, and thus I don't see why we cannot clarify this by adding it overnight. Dymola does detect it, since quite some time, - and no-one has complained that they don't want warnings for misplaced annotations.

Interesting. From System Modeler's point of view, I'd also be ready to make them errors according to the specification overnight. The reason is that when implemented in System Modeler, there would still be a grace period before we follow the specification strictly by making them hard errors.

I don't see why language version is particularly important for this issue. If people are using a newer version there might, of course, be both new annotations, new functions, and even grammatical constructs.

My point was that it isn't important. Language version would matter if we wanted to also reject unrecognized annotations (where vendor-specific annotations would of course not be considered unrecognized in this sense).

HansOlsson added a commit to HansOlsson/ModelicaSpecification that referenced this issue Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants