BlueStyle icon indicating copy to clipboard operation
BlueStyle copied to clipboard

Specify case style for enums

Open nickrobinson251 opened this issue 5 years ago • 1 comments
trafficstars

nickrobinson251 avatar Dec 10 '19 01:12 nickrobinson251

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()

iamed2 avatar Aug 27 '20 14:08 iamed2