iftechfoundation / twine-specs

Specs related to Twine
68 stars 5 forks source link

Twee 3: Unique Passage Names #11

Closed videlais closed 3 years ago

videlais commented 3 years ago

While Twine 2 actively prevents passages from having the exact same name, the Twee 3 Specification does not mention it.

I propose adding "unique" to the line for passage name under the Passage Header section. Something like the following:

Required passage name. This must be unique in the story.

ChapelR commented 3 years ago

AFAIK, the actual behavior of most compilers is that duplicate passages are replaced by the ones processed later. Should there be a recommendation about how compilers should actually handle duplicates?

videlais commented 3 years ago

Should there be a recommendation about how compilers should actually handle duplicates?

I think so, yes. I specifically ran into this issue with Extwee when a project accidentally had two 'Start' passages and did not have a start property in its StoryData passage. I'd much rather standardize how to handle this case than leave it up compilers to handle it in different ways.

mcdemarco commented 3 years ago

Should there be a recommendation about how compilers should actually handle duplicates?

I think so, yes. I specifically ran into this issue with Extwee when a project accidentally had two 'Start' passages and did not have a start property in its StoryData passage. I'd much rather standardize how to handle this case than leave it up compilers to handle it in different ways.

I'd recommend that the compiler warn the user and tell the user how it's handling the situation, but I don't see a need to regulate what it actually does about it. There are very few choices (use the first occurrence, use the last, or refuse to process until fixed), and the choice between them seems more a matter of taste than of anything in particular being the best approach.

tmedwards commented 3 years ago

I'm inclined to agree with Mary in that compilers should emit a warning of some type and any other behavior can be compiler determined.

The original Twee compiler used the last seen passage—Tweego does the same, while also emitting a warning—but other behaviors aren't wrong. I think the big thing is notifying the user so they can decide what to do, if anything.

videlais commented 3 years ago

I think there should be wording recommending against having passages with multiple names to prevent the edge case. If it occurs, however, I agree with having a recommendation to warn the user and, as suggested, leave the rest up to the compiler to handle.

What about the following wording for the Passage Name sub-section?

**Passage Name**

It is recommended that passages names should be unique within a story and not contain link markup metacharacters like [, ], or |.

COMPILERS: It is recommended that the outcome of a detecting multiple passages with the same name should be to emit a warning.
tmedwards commented 3 years ago

Woo. This got lost in the mists of time and space.

@videlais Aside from a few niggles, it looks good to me.

Suggestions:

**Passage Name**

It is recommended that passage names should be both unique within a story and not contain link markup metacharacters, like `[`, `]`, or `|`.

COMPILERS: It is recommended that the outcome of a detecting multiple passages with the same name should be to, at least, emit a warning.

EDIT: Minor edits to the suggested change example.