Skip to content

[feature] be able to set standard values for kwargs #30

@RiedleroD

Description

@RiedleroD

a function func f(string a, {string b}) -> void can be called like f("a", b="b"), but in every case, all kwargs have to be defined.

I propose something like func f(string a, {string b="default_b"}) -> void, after which you can call the function with all arguments f("a", b="b") or with b left undefined f("a") in which case b would fall back to the previously defined default "default_b"

this is useful e.g. for simple numeric defaults:

func log(int x, {int base=e}){
  # logarithm function that optionally takes a kwarg for its base, and otherwise does a natural logarithm.
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions