jtree icon indicating copy to clipboard operation
jtree copied to clipboard

Grammar: come up with a convention for handling multiple uses of a keyword in a map

Open breck7 opened this issue 2 years ago • 0 comments

Currently in Scroll the way the groups keyword is implemented is that the last instance of it overwrites any earlier instances. Right now I have a situation where I have a file with 2 groups lines and I want to join the values of those lines into one. But I could imagine I might have situations where I want the last one to win.

This general situation seems to come up in Tree Languages a lot. Is there a semantic convention that would work everywhere, for explicitly declaring what behavior is desired? The choices seem to be:

  • First wins: the first declaration is used
  • Last wins: the last declaration is used
  • Join: the items are joined (in this case, what join character is used?)
  • Subtract: the item is subtracted
  • Final: this line is used no matter where it appears (and the last final would win). Similar to !important in CSS.

I'm not sure if this should be done at the Grammar level or just in the implementations of various languages. Just posting it here now to think out loud.

breck7 avatar Jun 14 '23 01:06 breck7