Add a way to clarify ambiguous classinfos #7677
Replies: 2 comments
-
i agree with your thoughts about it being part of the literal parser and i like the overall idea |
Beta Was this translation helpful? Give feedback.
-
I'm just strongly against the design of |
Beta Was this translation helpful? Give feedback.
-
I would like propose adding a syntax to clarify ambiguous type literals in Skript.
Currently, certain words can refer to multiple types, which can lead to confusion and errors in scripting. For instance,
black
could refer to a color or a variant of a wolf. Horrifically,unknown
has over ten different matching types. This ambiguity can make it impossible for the parser to understand the intended meaning, especially in complex scripts.To address this issue, I suggest introducing a syntax that allows users to specify the type explicitly by using the pattern
<.+> (%classinfo%)
. For example:black (the wolf variant)
. This would clearly indicate to the parser that we are referring to the wolf variant rather than the color. We could even take it a step further and allow users to opt into a mode which forces them to specify the type when a type literal is ambiguous.My guess is that adding support for this directly to the type literal parser itself would be best. I worry that implementing it as an expression might affect parse times, but I would love more thoughts on that.
Beta Was this translation helpful? Give feedback.
All reactions