Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonical GF does not sort record fields consistently #102

Closed
johnjcamilleri opened this issue Mar 5, 2021 · 0 comments
Closed

Canonical GF does not sort record fields consistently #102

johnjcamilleri opened this issue Mar 5, 2021 · 0 comments
Assignees

Comments

@johnjcamilleri
Copy link
Member

Record fields in canonical GF are generally always sorted (with s first, then the remainder alphabetically), except for when they are not. Example discovered in FoodsFin.gf.

After compiling to canonical format:

$ gf --batch --output-format=canonical_gf FoodsFin.gf
Writing canonical/Foods.gf...
Writing canonical/FoodsFin.gf...

We see the following in canonical/FoodsFin.gf:

lincat
  Kind = {
    s : ResFin_NForm => Str;
    h : ResFin_Harmony;
    postmod : ParamX_Number => Str
  };

lin
  Cheese = {
    s = table { ... };
    h = ResFin_Back;
    postmod = table { ... }
  };

Here the fields in both the lincat and the lin are sorted the same way: s, h, postmod.
But also in the same file:

lincat
  Quality = {
    s : Prelude_Bool => ResFin_NForm => Str;
    hasPrefix : Prelude_Bool;
    p : Str
  };

lin
  Expensive = {
    hasPrefix = Prelude_False;
    p = "";
    s = table { ... }
  };

Here the fields in the lin definition are not sorted in the same way.
This is not a GF error, but can cause problems if you assume sorting is done consistently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant