Bug 471381 - Default values on function parameters
Summary: Default values on function parameters
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Golo (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2015-06-29 16:34 EDT by Julien Ponge CLA
Modified: 2016-05-25 10:27 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Ponge CLA 2015-06-29 16:34:16 EDT
(from https://github.com/golo-lang/golo-lang/issues/189)

Wouldn't be nice to do

function split = |text, seperator=";"| {
...
}

require(split("foo;bar") is ["foor", "bar"], "Default separator value)
require(split("foo:bar", ":") is ["foor", "bar"], "Explicited defined separator value)

---- yloiseau commented on 2 Oct 2014

:+1:

---- jponge commented on 2 Oct 2014

Yeah, it would be nice :smile:

---- danielpetisme commented on 2 Oct 2014

ie. DIY isn't it ?

---- jponge commented on 2 Oct 2014

That would make a fun exercise :-)

---- danielpetisme commented on 2 Oct 2014

Sounds famimiar. You told me the dame with the string interpolation :smile:

---- yloiseau commented on 10 Oct 2014

You can already do

function split = |text, seperator| {
...
}

function split = |text| -> split(text, ";")

require(split("foo;bar") is ["foor", "bar"], "Default separator value)
require(split("foo:bar", ":") is ["foor", "bar"], "Explicited defined separator value)

:smile:

my 2cts

---- yloiseau commented on 23 Oct 2014

btw, having named arguments/parameters would also be nice, and seems to be a related topic.