Optional arguments are a better alternative to function overloading

0
0
posted Aug 9, 2018
This argument is made by 'Peter von der Ahé' who works on the Dart language and argues against function overloading (https://groups.google.com/a/dartlang.org/forum/#!topic/misc/Ye9wlWih5PA). I personally don't fully understand why it would be a better alternative. – Whathecode Aug 9, 2018 18:17
I believe I understand the argument now. Depending on the type you 'fill in' a different parameter (which can be easily selected when they are named, as opposed to relying on argument position). However, in my opinion this severely complicates the method signature making it hard for the user to understand what to expect. E.g., what if two parameters are filled out? – Whathecode Aug 10, 2018 12:18