You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default arguments should just be AST nodes we can copy at call time if they're not provided.
They should be scoped to the caller of the function, so special expressions like #file are populated with the caller's values, unlike the Python behavior where defaults are globally scoped.
For example:
func fatalError(_ message:String, file:String= #file, function:String= #function, line:Int= #line){}
// This call here...
fatalError("Index out of bounds")
// ...desugars in Sema as:
fatalError("Index out of bounds", file: #file, function: #function, line: #line)
The text was updated successfully, but these errors were encountered:
harlanhaskins
changed the title
Support default arguments.
Support default values for function arguments
Mar 5, 2017
Default arguments should just be AST nodes we can copy at call time if they're not provided.
They should be scoped to the caller of the function, so special expressions like
#file
are populated with the caller's values, unlike the Python behavior where defaults are globally scoped.For example:
The text was updated successfully, but these errors were encountered: