Type definition statement ‐ the typedef keyword - JanJorgensen/StepBro GitHub Wiki
When using the same type for different purposes, it is possible to create a specific type for each usage. That makes the StepBro parser able to check if a variable is used for a wrong purpose.
In the following example, two different devices are using the same type of connection, the SerialTestConnection.
The typedef statements creates two different types, so procedures can use the right one as a parameter type, making the parser report an error if a variable of another type is passed to the procedure as argument.
typedef ProductConnection : SerialTestConnection;
typedef RelayControllerConnection : SerialTestConnection;
ProductConnection productConn = ProductConnection("COM3", 115200);
RelayControllerConnection relayConn = RelayControllerConnection("COM26", 9600);