Ticket #6 (new enhancement)

Opened 9 years ago

Last modified 9 years ago

Syntactic sugar for optionality and variants

Reported by: PeterLjunglof Owned by:
Priority: major Version:
Keywords: Cc:


Optionality and variants are so common so I think we need som sugar for these. optStr(...) only works for strings, and variants{...;...} is quite cumbersome to read and write. And both are difficult to notice in a rule.

Suggestion: ? for optionality and | for variants

Question: should ? be a prefix or postfix operator? personally I prefer prefix operators - they are easier to notice.

Change History

Changed 9 years ago by bringert

The | syntax has now been implemented.

?e is not quite as easy. What should it translate to if e doesn't have type Str?

Changed 9 years ago by bringert

Ah, and e? makes the GF term syntax ambiguous, is it e applied to a meta-variable, or an optional e?

Note: See TracTickets for help on using tickets.