It would simplify syntax and reduce small class clutter if we could include a ternary syntax conditional Control String Matcher.
Such a string would perhaps take the format {context:name?valueIfTrue:valueIfFalse} (from Example.cs)
{Person:Pronoun:Singular} bring{Person:Pronoun:IsAlwaysPlural?:s} you a gift
This would resolve to:
he brings you a gift
or
they bring you a gift
As long as the They pronoun returned true for IsAlwaysPlural
This would be set up something like this (in class Pronoun):
new ConditionalControlStringMatcher("IsAlwaysPlural", () => AlwaysPlural))
Some questions to consider:
- Should the ControlStringMatcher definition allow modifying the result? In the above example, we could add additional, optional parameters to provide funcs that take the passed in ternary values ("" and "s") respectively, and then modify them some way based on internal logic.
- Should we allow variables in the results? For example
{Person:MiddleName:Exists?MiddleName:} which would only show a person's middle name if it existed.
- Should we allow the context tree to go deeper? For example, allow something like
{Person:MiddleName:Exists?MiddleName:Initial:} which would print the initial of the person's middle name if one exists, otherwise blank.
It would simplify syntax and reduce small class clutter if we could include a ternary syntax conditional Control String Matcher.
Such a string would perhaps take the format
{context:name?valueIfTrue:valueIfFalse}(from Example.cs){Person:Pronoun:Singular} bring{Person:Pronoun:IsAlwaysPlural?:s} you a giftThis would resolve to:
he brings you a giftor
they bring you a giftAs long as the
Theypronoun returned true forIsAlwaysPluralThis would be set up something like this (in class
Pronoun):new ConditionalControlStringMatcher("IsAlwaysPlural", () => AlwaysPlural))Some questions to consider:
{Person:MiddleName:Exists?MiddleName:}which would only show a person's middle name if it existed.{Person:MiddleName:Exists?MiddleName:Initial:}which would print the initial of the person's middle name if one exists, otherwise blank.