Skip to content

Unlimited number of positional arguments and keyword arguments support in functions and methods. #152

@Almas-Ali

Description

@Almas-Ali

Is your feature request related to a problem? Please describe.
Often we need to handle unknown amount of arguments in function call. But till now, we don't have any way to handle this behavior.

Describe the solution you'd like
Syntax:

fun some(...args, ***kwargs)
{
    # args: [...]  Array
    # kwargs {...} HashMap
}

Inspired from Python.

Additional context
Syntax is not final yet. Suggestions are welcome.

Update:
New syntax is now:

  • Positional arguments ...args (Updated with Add variadic arguments from #152 #153)
  • Keyword arguments ***kwargs
  • Array unpacking [...[1,2,3], ...[5,6,7]]
  • HashMap unpacking {***{"key": "value"}, ***{"key": "value"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions