Overloading has one major disadvantage:
proc hasTwoIntArgs(x = 3, y = 4) = ...
hasTwoIntArgs(x = -1) # args: x = -1, y = 4
hasTwoIntArgs(y = -1) # args: x = 3, y = -1
proc hasTwoIntArgsInvalid(x, y) = ...
proc hasTwoIntArgsInvalid(x) = hasTwoIntArgsInvalid(x, 4)
proc hasTwoIntArgsInvalid() = hasTwoIntArgsInvalid(3, 4)
# Kind of repetitive if you ask me...
hasTwoIntArgsInvalid(x = -1) # args: x = -1, y = 4 -- ok!
hasTwoIntArgsInvalid(y = -1) # Compile-time error! x unspecified!
That's the main reason why Option[int] seems much better. However, it's not
transparent as you need to explicitly use some(...). However, you can write a
thin wrapper over Option[T] with an converter to T so that you can write it
transparently:
proc hasTwoOptionalArgs(x = inone(int), y = inone(int)) = ...
hasTwoOptionalArgs(x = 1) # x = isome(1), y = inone(int)
hasTwoOptionalArgs(y = 1) # x = inone(int), y = isome(1)