GrammaticalFramework/GF

should the `vars` oper be added to the Prelude?

Opened this issue · 2 comments

considering the problem I had at #28 with the extensive use of variants in a large grammar, the oper vars was proposed as partial solution:

-- hack to get the same behaviour as from variants. parses both, linearizes the first. 
oper vars : Str -> Str -> Str = \x,y -> pre { "" => x ; _ => y } ;

it then became a definition in a module of the grammar, but I wonder if it shouldn't be in the Prelude, so that no other grammars need to repeat its definition.

I don't have an opinion on this; I understand @aarneranta and @krangelov may have some plans to change the behaviour of variants at some point so that it doesn't explode that much?

Another point is that variants are not recommended in the resource grammar in any case, because it's better to have predictable output. It is better to define two functions: e.g. contracted and uncontracted negation in English (don't and do not), or different genders in second person pronoun. Then an application grammar can use variants to allow all of these.

Another point is that variants are not recommended in the resource grammar in any case, because it's better to have predictable output.

after having this argument twice I'm finally being convinced of this!

still, I think the vars oper seems useful enough as a way to parse typos (but not linearise them!) to warrant its inclusion in the prelude or some other core module...