lgrosz / ClimbLib

https://lgrosz.github.io/ClimbLib/
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Add "VB" #45

Open lgrosz opened 1 month ago

lgrosz commented 1 month ago

VB is a common addition to the Hueco grading system. It clashes with the current structure

struct {
  unsigned int value;
  GradeHuecoModifier modifier;
};

A new struct, like

struct {
  enum {
    GradeHuecoType_BASIC,
    GradeHuecoType_NUMERIC
  } type;
  union {
    struct {
      void;
    } basic;
    struct {
      unsigned int value;
      GradeHuecoModifier modifier;
    } numeric;
  } data;
};

Is much more complicated, but accurate.

lgrosz commented 1 month ago

I think a very common way of representing this would be making the grade-value be signed and letting negative values equate to "VB." But I think that isn't neatly explainable without text explicitly stating so. The tagged union does a better job describing intention through code.