TelluIoT / ThingML

The ThingML modelling language

Home Page:https://github.com/TelluIoT/ThingML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cast datatypes to ennumerations

ffleurey opened this issue · comments

It should be allowed to cast datatype to compatible enumeration. Example:

enumeration IndicatorMode as UInt8
{
OFF = 0
SOLID = 1
BLINK_SLOW = 2
BLINK_FAST = 3
}

var myint : UInt8 = 2

var myvalue : IndicatorMode = myint as IndicatorMode

Should be allowed by the checker even if there is the risk that the integer is not within range: with the explicit cast the developer has to make sure it is valid and is taking the responsibility.