DavidKinder / Inform6

The latest version of the Inform 6 compiler, used for generating interactive fiction games.
http://inform-fiction.org/
Other
199 stars 32 forks source link

Add //~n flag for dict words #259

Closed erkyrath closed 5 months ago

erkyrath commented 5 months ago

Original proposal: //w flag.

Or maybe //n, //~n (with //n being the default for most uses).

See discussion: https://intfiction.org/t/improving-the-noun-dict-flag/66683

erkyrath commented 5 months ago

Pasting in the context:

The I6 compiler sets the NOUN flag (bit 7) for dict words that appear in an expression, either in a function or as data. This is because any usage of a dict word might be part of noun parsing (called from a parse_noun property).

This is generally sensible for user code, but wrong for some library functions. E.g. LanguageVerb(), LanguageVerbLikesAdverb(), LanguageVerbMayBeName() wind up setting the NOUN flag on a bunch of verbs just by mentioning them.

My current plan is to add a //~n suffix which means "don't set the NOUN flag on this word this time." Then //n would explicitly set the NOUN flag. The default for words mentioned in expressions would be //n, but the library functions mentioned above would explicitly add //~n.

For the sake of completeness, //~p would mean "don't set the PLURAL flag this time." (The default behavior.) Note that if you write sheep//p in one place and sheep//~p in another, the //p wins.

This change would not affect the behavior of existing code. New code could make use of //~n to avoid accidentally setting NOUN on verbs.

erkyrath commented 5 months ago

I'll wrap up https://github.com/DavidKinder/Inform6/issues/244 before I start this, as it's the same bit of code.