Replies: 3 comments 14 replies
-
Bringing here discussion from document https://docs.google.com/document/d/1m0K2_1lwMMV4pcp_B2BamQrIaMImWBwfdyzMoOWHfa4/edit?disco=AAAAIXQzkYA TcoSequencer (consumer interface)@GISED-Link wrote:
Since we use twincat, can we use enum with the {attribute to_string} decorator? This way we just don't use any number for the steps @jozefchmelar wrote: It's faster to add new steps if they're identified by number. This way the enum class could become be way too big to read. And adding an enum for every step is cumbersome and frankly kinda annoying. @GISED-Link wrote: The idea of the enum is just simple. When you will afect the next step, instead of writting 'step := 200; // turn the red led on' @PTKu wrote: You can use ENUM instead of numerical literal, it will work that way. Each enumerator item must have unique value and it should be of default (INT) type. Jouke (don't know GH name) wrote : I agree with Roger here. It's a great feature provided by Twincat. So technically it could still be an INT value, but maybe for the example it's nicer to use the ENUM way. |
Beta Was this translation helpful? Give feedback.
-
I strongly disagree on this, but everybody is entitled to their own opinion. The given example
I think an Enum in place of the first parameter and second will give more context and automagically drops the descriptive String. The following code is less prone to errors in writing and, even more important, reading by others to improve maintainability which in frameworks like this imho 'mandatory'. My suggestion is that both enums can be printed to screen or with pragma strict removed, and this code needs no extra comment as it is written fluently, selbdescribing and leaves no place for 'guessing'
Thus avoid this kind of syntax;
|
Beta Was this translation helpful? Give feedback.
-
This is maybe off-topic here but anyways @GISED-Link @HAHermsen there is this comment from Gerhard #13 (comment), I'd like to know your opinion on that; we will need to address this question before we continue. |
Beta Was this translation helpful? Give feedback.
-
Discussion about basic classes arising from the framework description document:
https://docs.google.com/document/d/1m0K2_1lwMMV4pcp_B2BamQrIaMImWBwfdyzMoOWHfa4/edit?disco=AAAAIXQzkYA
Beta Was this translation helpful? Give feedback.
All reactions