Wrong nested choices and gather points should report as a compiler error
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 540
- PR merge metrics
- No merged PRs in 30d
Description
Just leaving it here as a transcript from the discord chat.
KumoKairo

Three choices displayed simultaniously but with the different nesting level. Two choices with four stars and one choice with three stars
(sorry for my english though, I'm completely illiterate)
**joningold** why can we have a set of choices with different nesting level like in this example?
Here we can separate choices with two-three-four dashes, but not more than that

NarramoreArt
The feature is called a gather. Sorry I'm not on top form today
KumoKairo
I've just re-checked on gathers and all examples include correctly numbered stars and dashes, none of the examples have different number of stars in choices
This example makes total sense

But if we decrease the number of dashes in a gather, it starts picking other choices

And another one if we only leave one dash

And if we remove the dashes completely, it displays only nested choices (as expected)

It's almost as the dash somehow takes precedence over the number of stars in choices and makes all the choices it have equal or more stars to have exactly that count of stars
Like if we have -- two dashes it will make all further choices that have at least two stars exactly two stars
NarramoreArt
I mean to me it seems to make sense that gathers take priority over other choices . I suppose it's reading every line until the next gather of equal or greater rank
KumoKairo
Why does it take the number of stars before the gather but not after?
We even have alternating nested choices here 3-2-3-2. Why it is that the nested choice after 2 is no longer considered nested?

NarramoreArt
It looks to me like it's just reading every choice until the next single dash gather. I think it's confused because the gather isn't nested, so we're not providing the syntax it expects?
KumoKairo
Yeah, seems something like that. But it still compiles without warnings or errors and I'm wondering whether it's an expected behavior
joningold can you please comment on this?
joningold
Ok so you’re getting in quite a muddle ..!
First up, an = on its own is text and will print an equals
Otherwise there is no reason to mix different nesting levels
So you’re “four stars then three dashes then four stars” or whatever will do something but it almost certainly isn’t what you actually want
The rules are :
- when you enter a sub block you increase the nesting level. You stay nested until you want to go back to the original block
- When the flow on any nesting level runs out, the weave looks downwards for any gather of a low nesting level and goes there
* top level choice * top level choice with sub options * * sub choice * * other sub choice - - both sub choices join here * * more sub choices * another top level choice. And it really is top level; the two star choice above won’t ever come here - gather point to which all the flow will eventually return
NarramoreArt
Thank you Jon for explaining it far more clearly and succinctly than I was. Today is not my day
joningold
So - going from one dash to 3 stars is Bad; the compiler should really reject it
But it looks like it actually Makes Everything Go Crazy based on your examples
NarramoreArt
I still think it's just trying its best to look for the next "least nested" thing it can settle on. One for the next version I suppose.
Thanks again for clearing that up jon
KumoKairo
> So - going from one dash to 3 stars is Bad; the compiler should really reject it
Why doesn't fail to compile and display an error instead? Is it just some legacy stuff that can be improved, or do Ink tests depend on this behavior?
joningold the reasoning behind the rules makes perfect sense to me as long as we stick to the recommended number of gathers and choice stars count
I was wondering about this behaviour because our writers (we have a bunch) seem to be using this stuff all over the place because it works (the not-correct number of stars in choices). But our internal compiler (the Ink superset) is more strict than the one that's used in the Inky, thus making some parts of stories incompatible between the two compilers. And as we're taking Ink as a ground point, we have to maintain complete backward compatibility with it
The ultimate question - is it possible to make the compiler to actually output these contraptions as an errors? Not in terms of tech, but in terms of maintaining backward compatibility for existing Ink projects
joningold
Yeah, it totally should report errors rather than supporting unpredictable/ confusing behaviour!
We’re just a bit busy making our game right now
======
To recap - compiler shouldn't allow for things like
```
* Choice AA
** Choice BA
** Choice BB
*** Choice CA
*** Choice CB
--
*** Choice DA
*** Choice DB
```
requiring choices to be separated by some `gather` with the exact number of dashes as the choice nest level that it tries to separate, lest it leads to all sorts of bad things.
Our studio is on this issue right now, and we will either submit our own alternative compiler, or will submit some changes to the current one
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.