Named arguments

Parameters to functions can be provided by name or order.

Named arguments provide additional clarity and safety when a function has multiple arguments of the same type, especially if the arguments have default values. 1

hello :: (name: string, phrase: string) {
  printf("My name is %s.  %s\n", name, phrase);
hello("fred", "booya"); // fine.
hello("booya", "fred"); // oops. but compiler can't help us.
hello(phrase = "booya", name = "fred"); // fine again.
hello("fred", phrase = "booya"); // also fine.
hello(name = "fred", "booya"); // error: unnamed arguments can't follow named ones.

  1. named arguments are useful when you have a function with a whole lot of arguments and the arguments are sometimes of the same type as each other, and so the type checker isn’t going to catch you if you pass them in the wrong order, or you accidentally forget one, or there’s some default arguments at the end. If you don’t have default arguments in your language it’s less of a problem [..] so if you have default arguments, then I think you want named arguments.
    “Arguments and Return Values” YouTube, uploaded by Jonathan Blow, Mar 10, 2015, 

jailang 2019 pixeldroid
programming pages theme v0.5.21 (