Re: Keyword Arguments

Jan-Paul Bultmann <[email protected]> Sat, 09 Jun 2012 21:53:47 +0200
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
With single args and proxy objects ;P

Color clone red:50 green:19 blue:100

Cheers Jan

On Jun 9, 2012, at 9:22 PM, Kurtis Rainbolt-Greene wrote:

> One of the cool things about SmallTalk, and other languages including
> Ruby in v2, was the keyword argument syntax sugar (pseudo-code):
> 
> define help(title, keywords, options)
> # Logic Here
> end
> 
> Then you could call a function like so:
> 
> help("this is the title", ["thing", "thang", "thong"], {"format"
> => "ascii"})
> 
> Or with keyword arguments:
> 
> help(title: "this is title", keywords: ["thing", "thang",
> "thong"], options: {"format" => "ascii"})
> help(options: {"format" => "ascii"}, title: "this is title")
> 
> The second version is where the real advantage comes in: Being able to
> have unordered arguments. It reduces refactor problems that are solely
> in the realm of order of arguments.
> 
> It also helps people learn the concept of arguments faster ("Oh, these
> map to these!").
> 
> Brings me to the question: How would you implement this in Io? Not
> just code wise, but syntax. Since Io has no Map literals you might
> have to invent some new syntax concepts.
> 
> -- 
> Kurtis Rainbolt-Greene, Hacker
> Difference Engineers, LLC
> 643 Magazine St. #102
> New Orleans, LA 70130
>