go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.98k stars 276 forks source link

Correct the types of constants in blocks for Type and Comparator #80

Closed michaelbironneau closed 5 years ago

michaelbironneau commented 5 years ago

The constant blocks for Type and Comparator correctly define the type of the first constant in the block as Type and Comparator, respectively, but the other constants are then automatically inferred as string or ints. This leads to issues when using the library with gophernotes. See https://stackoverflow.com/questions/6937716/grouping-of-constants-in-go-language for some discussion of enums in Go.

See the below example from the official Go documentation at https://golang.org/ref/spec#Constant_declarations:

const Pi float64 = 3.14159265358979323846
const zero = 0.0         // untyped floating-point constant
const (
    size int64 = 1024
    eof        = -1  // untyped integer constant
)
const a, b, c = 3, 4, "foo"  // a = 3, b = 4, c = "foo", untyped integer and string constants
const u, v float32 = 0, 3    // u = 0.0, v = 3.0

This pull request addresses this issue by ensuring that all constants within each block have the same type.