You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
Enums are nice for type safety and limiting strings to a known set of choices. For example join rules, there's invite, private, knock, public and restricted.
However, this restrictive convenience isn't in the spirit of matrix's extensibility. A server may introduce a custom join rule, which is a perfectly acceptable thing to do in matrix, but using an enum for join rules would prevent matrix-kt from being able to parse the join rule event.
In the case of join rules, it is easy to use polymorphism to allow for extensibility but for some other cases a plain String is more appropriate. A separate object can provide constants to prevent hard coding the enum values.
I understand some people may not like this but I can't think of sane alternatives to keep matrix-kt extensible.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Enums are nice for type safety and limiting strings to a known set of choices. For example join rules, there's invite, private, knock, public and restricted.
However, this restrictive convenience isn't in the spirit of matrix's extensibility. A server may introduce a custom join rule, which is a perfectly acceptable thing to do in matrix, but using an enum for join rules would prevent matrix-kt from being able to parse the join rule event.
In the case of join rules, it is easy to use polymorphism to allow for extensibility but for some other cases a plain String is more appropriate. A separate object can provide constants to prevent hard coding the enum values.
I understand some people may not like this but I can't think of sane alternatives to keep matrix-kt extensible.
The text was updated successfully, but these errors were encountered: