liquidev / euwren

High-level Wren wrapper for Nim
MIT License
36 stars 0 forks source link

Enums #1

Closed liquidev closed 4 years ago

liquidev commented 4 years ago

Enum binding is not supported. Code like this:

type
  MyEnum = enum
    myA
    myB
    myC
wren.foreign("enum"):
  MyEnum

should automatically produce a module call to add the following code:

class MyEnum {
  static myA { 0 }
  static myB { 1 }
  static myC { 2 }
}

Aliasing should be supported through the NimName -> WrenName syntax. Automatic prefix stripping should be supported through the MyEnum - prefix syntax. These two should be combinable into MyEnum - prefix -> WrenEnum.

Numbers from Wren should be converted to enums. Type checking is not going to work, because it would require a big overhead, while enums are supposed to be lightweight and fast.

liquidev commented 4 years ago

Fixed in 0.6.0.