BlueStyle
BlueStyle copied to clipboard
Specify case style for enums
trafficstars
I think this depends on the type of enum. There are three I can think of off the top of my head that might have different rules.
The examples below should not be construed to endorse any case style.
One: The enum is a concrete type and the options are instances of the type, and they all exist in the same scope. This is what @enum does. E.g.,
@enum Fruit apple banana
Two: The enum is a scope (e.g., a module) and options are constant values of any type. E.g.:
baremodule Fruit
const apple = 0
const banana = 0
end
Three: The enum is an abstract type and the options are singleton subtyes. E.g.:
abstract type Fruit end
struct Apple <: Fruit end
struct Banana <: Fruit end
const apple = Apple()
const banana = Banana()