Function modifier rework - #8847
Conversation
| /** | ||
| * Represents a modifier that can be applied to a function signature. | ||
| */ | ||
| interface Modifier { |
There was a problem hiding this comment.
why do we have 2 modifier interfaces now? Can't they be unified? idk it seems a bit confusing to have these duplicated
There was a problem hiding this comment.
the modifiers mentioned here are applicable to function signatures (e.g. local or async). the other modifiers are for parameters (e.g. optional, keyed). i don't think it makes sense to merge them, since additional checks would be required to determine whether any given modifier is applicable to a signature or a parameter. do you think it could be useful to have a unified interface for modifiers that feature the priority and toFormattedString functions?
also, referencing these two modifiers is done through Signature.Modifier and Parameter.Modifier. do you want me to rename them to something clearer?
Problem
Parameter modifiers previously did not have proper support for containing data within a modifier, requiring messy code to make it work. Additionally, modifiers that defined constraints (such as RangedModifier) required internal changes to check values, thereby not allowing any addon from registering a custom modifier.
Signature modifiers, such as a function being local or returning a value, were previously dictated by fields in the Signature class. To allow for easier future expansion, signature modifiers have been migrated to use the same system as parameter modifiers.
Solution
Parameters
Signature
Priority
Parameters.java
Testing Completed
Added ParameterTest and SignatureTest for testing toFormattedString, and existing tests.
Supporting Information
Completes: none
Related: #8657
AI assistance: none