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
In many cases, we want to accept either a struct or an id as an argument to an function. I'm curious if there is a sane, reusable pattern that can be used instead of inconsistent usage of function clauses.
For example, passing the Message struct as the first argument to message-related API calls sometimes pattern matches the relevant keys off of the struct (id and channel_id) and in other times, there is no function clause available.
This may be not worth the amount of complexity needed to abstract this kind of functionality, but we can discuss below.
The text was updated successfully, but these errors were encountered:
In many cases, we want to accept either a struct or an id as an argument to an function. I'm curious if there is a sane, reusable pattern that can be used instead of inconsistent usage of function clauses.
For example, passing the
Message
struct as the first argument to message-related API calls sometimes pattern matches the relevant keys off of the struct (id
andchannel_id
) and in other times, there is no function clause available.This may be not worth the amount of complexity needed to abstract this kind of functionality, but we can discuss below.
The text was updated successfully, but these errors were encountered: