monkey2
monkey2 copied to clipboard
Can to access enum members by enum instances
Working on image processing app I found that: https://github.com/blitz-research/monkey2/blob/f3ed955eb732b224970a7ea6bf77f00cb967c563/modules/std/graphics/pixmap.monkey2#L154
Here, Format is a property (Format:PixelFormat) of Pixmap, and it's used in Select statement as a PixelFormat equivalent. I think it's a typo.
I tried this way on test app and it works correct, so it's almost not a bug,
but if we'll try to write similar code in c#, we'll get compile time error:
DataFormat.F1' cannot be accessed with an instance reference; qualify it with a type name instead
Test app:
Namespace myapp
#Import "<std>"
Using std..
Function Main()
Local f:=DataFormat.F2
Select f
Case f.F1 ' <- nonsense usage of enum member
Print "f1"
Case f.F2
Print "f2"
Case f.F3
Print "f3"
End
End
Enum DataFormat
F1
F2
F3
End
I've prepared pull request with pixmap fix.
Fixed with e712589. Issue can be closed.