-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
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)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels