Browse source

Changelog

Query
From:
To:
Branch:
Path:
Message:
BugID:
User: +
Format:
: 3 checkins (+756/-42) by Henrik Grubbström (Grubba) <grubba@grubba.org> Lines added/removed recently

Saturday 03 September 2022

2022-09-03 10:39:57 (3 months ago) by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Add syntax for specifying default values for functions.

The function definition

string foo(string bar = "bar") { return bar; }

will now result in a function(string|void:string) that returns
"bar" if called with no arguments or UNDEFINED, and its argument
otherwise. The local variable 'bar' above will be typed string
(ie not string|void) in the function body.

Fixes some of #10086.

[permalink]

Bugs mentioned

  #10086CLOSEDAdd syntax for specifying default values for optional arguments.
Bugs? Suggestions?