4 ms·
I don’t understand what you are saying? In scala you do not have to match on all parameters. You can use the underscore operator to skip the other attributes.
by 0x008 6y ago
I don’t understand what you are saying? In scala you do not have to match on all parameters. You can use the underscore operator to skip the other attributes.
Also you can match a map since every map is just a sequence of Tuples in scala. However why would you ever do this? It is really impractical for large sequences and if I have only a very limited number of attributes I would not use a map I guess.
- tomsmeding 6y ago> You can use the underscore operator to skip the other attributes And have to add an underscore in the right position when you ever add an attribute? With partial matching like described, you don't have to change the pattern when adding fields to the data structure. I guess the GP was referring to this.
- 0x008 6y agoWell that is a little bit different I guess. You probably could do some unapply shenanigans to achieve the same result but that off the top of my head I would not know how to do that.
- vletal 6y agoWell sure, wildcards still count as matching. The ability to use named params instead could clean some codebases a bit. Also I get that there are reasons for the Map matching not being present in Scala. All I am saying is that it's cool that it's in python.