https://kotlinlang.org logo
Title
m

mattmoore

06/30/2020, 7:38 PM
@shikasd Awesome work so far! One thought I had was on the "marking" of the expression to match. So as @raulraja pointed out, we've got
case
synthetic to act as a marker. In the current iteration, it's looking at
when
subject, but we would also need to handle the expression when it's not a
when
subject or even outside
when
entirely. For example:
val matt = Person("Matt", "Moore")
val Person(_, lastName) = matt
Another example would be for matching on lists (though that's not quite in scope just yet, as there's more stuff to solve there). I'll be able to experiment more with this tonight. Of course, I'm still new to the internal APIs so having your help, Raul's help, and everyone else on that has been a tremendous boost to this effort. So thank you for that! 🙂 If I'm able to figure out how to generalize the current version without
when
expressly (so it'll work in more general cases) I'll push some code up. Unless you beat me to it 😉 Thanks @Rachel for looking into 1.4. I'm very eager to see 1.4 be finally ready, as I'm sure all of you are as well 🙂
🙌 2
Of course, I realize that the example I listed above for destructuring with the value assignment does not have
case
so that might be another scenario where we need to use
case
- unless we can find another way to mark that out.
s

shikasd

06/30/2020, 8:24 PM
Note that it is something Kotlin does not parse by default:
m

mattmoore

06/30/2020, 8:38 PM
Ah yes. I think there may have been some other syntax we figured out. I think we had this discussion earlier in this channel.