-
Notifications
You must be signed in to change notification settings - Fork 63
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
Reaction names should be used as a default #2355
Comments
I am not sure if I follow. By reaction label, you mean the yellow box that appears when using the |
I mean the label that is inside a reaction e.g. currently this is something like "1" or "2". One can declare a label for it, by doing something like "reaction 'insert name' (...)" which I think assigns more meaningful label to a reaction than "1". If the option show reaction labels is enabled, it currently shows the label if there is any but displays "reaction_1" for reaction 1 if it does not have a label. I think "1" should be a better default label and that reactions should be labeled as a good developer practice. |
Ok, so it seems like you are referring to reaction names (not labels) and the "Reaction names" option. Right? This option is intended to show the name of the reaction as it is used in generated code (i.e. it represents the name of the generated function that implements the reaction body). Showing the name is particular important when bodyless reactions are used (i.e. we only code-generate a skeleton and the function implementation is provided externally). It is important to distinguish label and name here. The label can be an arbitrary string. The reaction name needs to be a valid identifier, and in most languages numbers are not valid identifiers. |
I'm not sure reactions should be named as good developer practice. The order of reactions is semantically important, so I think the diagram label should include the number even is the reaction is named. I agree that "reaction_1" is a pretty ugly label, and "1: reaction_1" would be even uglier... |
Agreed. This should be a trivially easy fix... |
Additionally, my point is that labeling a reaction "send" is always better than just having a name that says "2". |
Why? What does "send" mean? Not all reactions send anything. |
"send" would be the name I would want to give a reaction by writing |
If we change this behavior, then the names displayed in the diagram do no longer correspond to their identifier in generated code. Displaying |
@cmnrd I do not understand your statement. What are you referring to? Why should "reaction_1" be better than "1"? Or if the reaction has a name, why should "1" or "reaction_1" be better than displaying "send" for a reaction I named "send" in the code? Even if the reaction code uses "reaction_1" and cannot use "1" as a name, I am pretty sure people can infer the "reaction_". Additionally, we do never lose the connection between diagram and code since clicking on a reaction will highlight it in the code. |
To explain this further: We introduced reaction names to provide bodyless reactions. For bodyless reactions, the reaction body is provided externally (not in the LF file). The user needs to implement a function that is appropriately named. For Since initially you called the reaction names labels, it seems like you have a different use-case in mind. Could you elaborate on your use-case and why the |
I called them labels since they are KLabels (I think). Name or label is just an overloaded term. Generally, I think that I do not want that "1" can be a name. I just what that the "label" of the KNode in the diagram that represents the reaction if names should be displayed in a readable and concise manner. But if you do not like it, feel free to not implement this and close the ticket. |
Just to be clear: I did not comment on the quality of the proposal or how I like it. I actually think your user story makes sense. I am pointing out that there is a user story that we already have committed to that conflicts with the concrete implementation that you propose. That is not a matter of my personal taste. As I stated before, I think your user story makes sense, and I don't think it is necessarily at odds with the existing one. I am sure there is an alternative implementation that allows us to achieve your goal without breaking an existing feature. I want to invite you to work on this constructively, and I am happy to assist in finding that solution. |
I would like to use reaction labels as a default and not just their numbering.
Additionally, I would like the reaction label to be just the number if it does not have a label and not reaction_i for reaction i.
This way, the diagram would not change for models that do not have labeled reactions while still using a desirable default.
The text was updated successfully, but these errors were encountered: