Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
ion
ion
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 94
    • Issues 94
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 2
    • Merge Requests 2
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • redox-os
  • ionion
  • Issues
  • #834

Closed
Open
Opened Dec 04, 2018 by Zach Button@Zach-Button

Cannot write functions with variable argument count

It appears to only be possible to define functions with a fixed number of arguments.

Perhaps the simplest solution would be some basic polymorphism. Example:

fn doStuff a b
	echo a: $a, b: $b
end

fn doStuff a
	doStuff $a "not_specified"
end

doStuff "test" 
# "a: test, b: not_specified"

Or, perhaps cleaner, argument expansion:

fn printSection label ...list
	echo -e "\n\n$label:"

	for item in @list
		echo "- $item"
	end
end

printSection todo "type foo" "make bar"
# todo:
# - type foo
# - make bar
Edited Jan 11, 2019 by Zach Button
Assignee
Assign to
unplanned
Milestone
unplanned
Assign milestone
Time tracking
None
Due date
None
Reference: redox-os/ion#834