-
Notifications
You must be signed in to change notification settings - Fork 41
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
Clarification about encapsulated short class definition #3270
Comments
It shouldn't be allowed.
It was added to resolve #2743 (where the class names used With indirect I mean that the specification currently contains the following to illustrate the rule:
But you could also do:
Where Load4 had the same issue with modifiers as Load2. |
Right then we need to rephrase the specs because the suggestion that it only applies to modifiers is ambiguous. |
You seem to mean
|
Local classes can be a problem in general, but P.Main isn't a package and B isn't encapsulated so you are not allowed to use it. |
That's not what the specs currently say:
The way it is written only applies to the first part of the name being a package. Also, I am not sure what the following mean:
I guess we should remove |
Oh, that restriction must be present for all parts (in a normal recursive way). Similarly for the partial restriction. |
Hm... I believe we should move the 'and ...' into the parenthesis, giving: If the identifier denotes a class, that class is temporarily flattened (as if instantiating a component without modifiers of this class, see section 7.2.2 and using the enclosing classes of the denoted class). |
For the original issue, as well as specifying that the restriction also applies to the base class itself, we could add a non-normative text pointing out that for an encapsulated short-class definition the base class reference must be fully qualified. |
It may be helpful to point out that this references section 5.3.2 (Composite Name Lookup). |
Change grammar for two reasons: * It is type-specifier not IDENT * For encapsulated we really need the leading "." which is part of type-specifier. Closes modelica#3270
* Clarify encapsulated. Change grammar for two reasons: * It is type-specifier not IDENT * For encapsulated we really need the leading "." which is part of type-specifier. Closes #3270 * Clarify composite name lookup (related to encapsulated). * Clearer on global name lookup. * Consistent use of terminology. * Update chapters/classes.tex Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Section 4.5.1 says:
Which only provides a constraints for the modifiers.
Does that mean that the following is valid:
The text was updated successfully, but these errors were encountered: