-
Notifications
You must be signed in to change notification settings - Fork 80
Reduce usage of untyped interface{} and casting #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
olabiniV2
pushed a commit
that referenced
this issue
Dec 26, 2021
olabiniV2
pushed a commit
that referenced
this issue
Dec 26, 2021
olabiniV2
pushed a commit
that referenced
this issue
Dec 26, 2021
olabiniV2
pushed a commit
that referenced
this issue
Dec 26, 2021
olabiniV2
pushed a commit
that referenced
this issue
Dec 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a large amount of places - especially in interactions with other parts of Coy - where the GUI uses the
interface{}
type and then casts it in different ways. Sometimes, we also use more specific types, but then do type-switches anyway. We should try to rely more on the compiler to help us give advice when we're doing things that are problematic by reducing use of type switches.There are two big areas where we should be extra careful with this. The first one is with all the MUC message code. Here, we wanted to separate the implementation of the data-types from the
session/muc/data
package from the representation of messages and other actions. For this reason, type-switches are used a lot - and in some cases just regular switches but based on pseudo-types, such asIsOwner
, etc. We should move to using theVisitor
pattern for most of these places.The other place is where we are interacting with different parts of GTK that is untyped. For example, in the
ListModel
storage, and also using GLib properties. In this places, we should implement wrapping structures or methods, and reduce the place that calls the untyped functionality as much as possible.The text was updated successfully, but these errors were encountered: