treeform / pixie

Full-featured 2d graphics library for Nim.
MIT License
743 stars 28 forks source link

The great enum rename. #312

Closed treeform closed 2 years ago

AmjadHD commented 3 years ago

What's the point of this change ?

Unless marked with the {.pure.} pragma, members of enums should have an identifying prefix, such as an abbreviation of the enum's name.

type
  PathComponent = enum
    pcDir
    pcLinkToDir
    pcFile
    pcLinkToFile

Non-pure enum values should use camelCase whereas pure enum values should use PascalCase.

type
  PathComponent {.pure.} = enum
    Dir
    LinkToDir
    File
    LinkToFile
SolitudeSF commented 3 years ago

that styleguide entry was written before there was enum overloading

treeform commented 3 years ago

Enum overloading is the new thing in experimental, which in my mind removes {.pure.} enums and makes all enums behave how you would expect without the need for the strange name prefix. And this is the experimental branch using this feature.

treeform commented 2 years ago

Doing a different PR now.