First the python code generator works fantastic. I appreciate all of the work that went into writing that plugin. I am assuming the code generators are proprietary as I am unable to find them in your GitHub profile or statecharts repository.
While the implementation for a simple statemachine is fairly straight forward and simple. The more complex the statechart becomes with submachines and loosely coupled state machines the more redundant writing the run time becomes. I would love to contribute to them if I can I have over 5 years of professional experience with Python. If not I'll suggest what I would consider improvements below. Please keep in mind this is constructive criticism and as I stated early I am great full for my personal use license as I am well aware of the amount of time that went into developing this project. Also I have no idea how much knowledge you and your team have pertaining to Python. I'm sure these ideas were discussed and decided against for valid reasons.
example 1:
# Implementation of statechart example_statemachine.
import warnings
# implemented interfaces:
from .example_statemachine_interface import SCI_Interface
# to store states:
from enum import Enum
class Example_Metaclass(type):
sci_interface = SCI_Interface
def __new__(mcs, name, bases, dct, sci_interface=SCI_Interface):
return super().__new__(mcs, name, bases, dict(dct, sci_interface=SCI_Interface)
def __call__(mcs, *args, **kwargs):
# here we do the setup for the interface
instance = super().__call__(*args, **kwargs)
instance.sci_interface = mcs.sci_interface(instance)
return instance
class Example(metaclass=Example_Metaclass):
# ... normal generated code
user code
class Example_Interface(Example_SCI_Interface): pass
class Example_Implementation(Example, sci_interface=Example_Interface): pass
This particular example uses Metaclass key word arguments thus only valid in Python version 3.x and above. Since most of the sci_interface code is implemented in the generated statemachine class with the exception of operations and non-builtin sct types. This would be fairly straightforward to implement.
I'll add more suggestions to this issue throughout this coming week
First the python code generator works fantastic. I appreciate all of the work that went into writing that plugin. I am assuming the code generators are proprietary as I am unable to find them in your GitHub profile or statecharts repository.
While the implementation for a simple statemachine is fairly straight forward and simple. The more complex the statechart becomes with submachines and loosely coupled state machines the more redundant writing the run time becomes. I would love to contribute to them if I can I have over 5 years of professional experience with Python. If not I'll suggest what I would consider improvements below. Please keep in mind this is constructive criticism and as I stated early I am great full for my personal use license as I am well aware of the amount of time that went into developing this project. Also I have no idea how much knowledge you and your team have pertaining to Python. I'm sure these ideas were discussed and decided against for valid reasons.
example 1:
user code
This particular example uses Metaclass key word arguments thus only valid in Python version 3.x and above. Since most of the sci_interface code is implemented in the generated statemachine class with the exception of operations and non-builtin sct types. This would be fairly straightforward to implement.
I'll add more suggestions to this issue throughout this coming week