4 ms·
You can have named parameters and backward compatibility with method signatures, Groovy does that [1]. Ok, it cheats a little bit because named params are actu
by diegof79 7y ago
You can have named parameters and backward compatibility with method signatures, Groovy does that [1].
Ok, it cheats a little bit because named params are actually a syntax sugar for Maps. But other languages do the same (e.g. Python) and is very useful too. And if you can type check the map (as in Typescript) the functionality is equivalent to named params.
[1] http://docs.groovy-lang.org/latest/html/documentation/#_named_parameters http://docs.groovy-lang.org/latest/html/documentation/#_name...
- viraptor 7y agoPython has real keyword parameters, not just a syntax sugar. They're just presented as a dict when you want to see them all. And you can splat that dict when calling. Ruby before 2.7 has a syntax sugar where keyword parameters are the same as a trailing hash. But that's changing as well.