Difference between revisions of "Keyword arguments"
From HaskellWiki
Tomjaguarpaw (talk | contribs) (Deleting page that hasn't been edited for over 10 years) |
m (Reverted edits by Tomjaguarpaw (talk) to last revision by DonStewart) |
||
Line 1: | Line 1: | ||
+ | "We show the Haskell implementation of keyword arguments, which goes | ||
+ | well beyond records (e.g., in permitting the re-use of labels). Keyword | ||
+ | arguments indeed look just like regular, positional arguments. However, | ||
+ | keyword arguments may appear in any order. Furthermore, one may | ||
+ | associate defaults with some keywords; the corresponding arguments may | ||
+ | then be omitted. It is a type error to omit a required keyword argument. | ||
+ | The latter property is in stark contrast with the conventional way of | ||
+ | emulating keyword arguments via records." | ||
+ | [http://okmij.org/ftp/Haskell/types.html#keyword-args Genuine keyword arguments] | ||
+ | |||
+ | [[Category:Idioms]] |
Latest revision as of 15:18, 6 February 2021
"We show the Haskell implementation of keyword arguments, which goes well beyond records (e.g., in permitting the re-use of labels). Keyword arguments indeed look just like regular, positional arguments. However, keyword arguments may appear in any order. Furthermore, one may associate defaults with some keywords; the corresponding arguments may then be omitted. It is a type error to omit a required keyword argument. The latter property is in stark contrast with the conventional way of emulating keyword arguments via records."