Hello there.
I am new in Fantom.
I just want know is Fantom support named arguments for functions like Python?
Or maybe it is realized in different way?
I think Python named arguments is very useful ability.
Ruby's way:
def image(opt={}) default_opt = {:height => 25, :width => 10} default_opt.merge! opt end
May be i wrong asked question i mean how i can do it in Fantom language? I just can't found in documentation.
There is no language support for named parameters. However, the work around is similar to the Ruby example above using a Map literals:
Void doIt(Str req, Str:Obj opts := [:]) { ... } doIt("required", ["something":3, "another":true])
Login or Signup to reply.
ivix Sat 23 Apr 2011
Hello there.
I am new in Fantom.
I just want know is Fantom support named arguments for functions like Python?
Or maybe it is realized in different way?
I think Python named arguments is very useful ability.
go4 Sat 23 Apr 2011
Ruby's way:
ivix Sat 23 Apr 2011
May be i wrong asked question i mean how i can do it in Fantom language? I just can't found in documentation.
brian Sat 23 Apr 2011
There is no language support for named parameters. However, the work around is similar to the Ruby example above using a Map literals: