gin-config icon indicating copy to clipboard operation
gin-config copied to clipboard

Add a registration method for enum classes

Open NielsPichon opened this issue 1 year ago • 0 comments

There are instances where we may want to pass an enum class as argument of a parameter in a gin config. However because in most cases, enums are not derivable , it is not possible to decorate an enum class with gin.register in most cases.

This MR introduces a new register_enum function which has a workaround for this problem. It essentially uses constant() under the hood to register the enum class. This is ok I think as enum classes are not meant to be directly instantiated so no arguments may be parametrized in the gin config file.

NielsPichon avatar Jul 11 '22 17:07 NielsPichon