-
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
Clarify final for classes. #2719
Conversation
OK, I've asked him to leave a comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so now we have a pretty extensive example, but it makes me wonder if adding and adding to the example was really the right approach for defining what final
means for a class.
Shouldn't the example just show what has been described in the normative text? The example suggests that there could be at least two missing parts in the normative text:
- Inheritance.
- Redeclaration.
(Still, I'd like someone with more experience of modeling with final classes to provide a review with approval.)
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
True. But the new definition is "no modifiers for elements when using the class"; and all the example follow that. |
The problem is that "using" is too vague when it comes to the things which could be considered indirect uses (things that are possible in presence of inheritance and redeclaration). |
Since (I'm asking this because I wish I was in a position where I would feel confident coming with concrete proposals for what the design should be, instead of just pointing out holes in the proposed specification.) |
Regarding MAP-Lib, I opened a PR, modelica/ModelicaStandardLibrary#3649 to remove the |
I agree - and I tried to reformulate it to say that all elements are seen final and include that in the example; and also remove some of the odd examples as they seemed less important. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new approach in terms of final elements looks promising.
So you mean that |
Giving some more thought to
To capture this one could write:
|
The grammar only allows 'redeclare final'; but my assumption is that some wanted to make the 'redeclare' more final by adding on a 'final' - or was influenced by other languages without 'redeclare' where instead 'final' is used to prevent further overriding of virtual function; and both were added - like "belt and suspenders". |
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
I think everything should be done now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me now: The normative text states the rules, and the example is only there for illustration. I'll ask @d-hedberg once more for final comments.
Look good to me. The only change I would propose is to remove the line reading: That line emphasizes class elements. If I understand you correctly, the intent was to make it clear that all elements, including class elements are made recursively final. However, that statement can also be a source of confusion, making the reader wonder if only class elements are recursively made final, and not component elements. |
Well remove, or simplify to ""This definition applies recursively to the elements of the class." |
I may be missing out on the context, but what exactly is "This definition".
Wouldn't it be better to just write:
"Final is applied recursively to the elements of the class".
…On Wed, Nov 25, 2020 at 2:44 PM Hans Olsson ***@***.***> wrote:
Look good to me. The only change I would propose is to remove the line
reading:
"This definition applies recursively to the elements of the class that are
also classes."
That line emphasizes class elements. If I understand you correctly, the
intent was to make it clear that all elements, including class elements are
made recursively final. However, that statement can also be a source of
confusion, making the reader wonder if only class elements are recursively
made final, and not component elements.
Well remove, or simplify to ""This definition applies recursively to the
elements of the class."
Which one do you prefer?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2719 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUNZQ37TYX34JA52L3OBC3SRUC3XANCNFSM4TYPNUNA>
.
--
Mvh,
Daniel Hedberg
|
OK, I think you didn't read it as intended. The sentence speaks only of the class elements since it is only for class elements it makes sense to apply the rule recursively. For non-class elements (component declarations), this rule has nothing to say in addition to just treat them as final components, which is defined in the first paragraph of the section… Now, when I read that paragraph together with the paragraph added by this PR, I'm actually unable to see that the new normative paragraph is adding. Which part of the new rule doesn't follow by this general rule:
I'm afraid we've been going in circles, and that the only part we should keep is the new example… possibly with some added text to the two examples saying that the first is Final modification, and the second is Final class declaration? |
That would also work for me; assuming the first is "Final component modification"; as the distinction is more between component and class. |
Sounds good to me. |
Also change comment indentation.
Done |
Closes #2676
(I couldn't easily add @d-hedberg as reviewer, since not part of project.)