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
Hi,
I would like to suggest an enhancement for enums conforming to CasePathable by providing a means to obtain a CaseKeyPath from an instance. Currently, to determine if two instances of CasePathable are the same case, we need to write code like the following:
@CasePathableenumFoo{case c1
case c2(Int)varcaseKeyPath:PartialCaseKeyPath<Self>{switchself{case.c1:return \.c1
case.c2:return \.c2
}}}leta:Foo=.c2(0)letb:Foo=.c2(1)print(a.is(b.caseKeyPath)) // true
Writing this code repeatedly is quite cumbersome. Therefore, I propose that the caseKeyPath should be generated by the CasePathable macro, to simplify the process and improve developer experience.
@Ryu0118 Thanks for the discussion. It's come up a few times :) We decided to implement via #158, which should hopefully be released soon. Let us know if you have any comments!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I would like to suggest an enhancement for enums conforming to CasePathable by providing a means to obtain a CaseKeyPath from an instance. Currently, to determine if two instances of CasePathable are the same case, we need to write code like the following:
Writing this code repeatedly is quite cumbersome. Therefore, I propose that the caseKeyPath should be generated by the CasePathable macro, to simplify the process and improve developer experience.
All reactions