In my practice such use cases sometimes happens when logging and error handling.
- Functions partial apply is a common case for different APIs.
Imagine two functions:
foo(arg, option1, option2, file, line)with several arguments and options for non typical cases.- The second one is
bar(arg, file, line)for typical common cases.
bar calls foo, pass default options and file/ line are passed from bar to foo.
func bar(arg, file, line) {
foo(arg: arg, option1: .o1, option2: o2, file: file, line: line)
}
If foo is called directly then #file & #line are used
2. Error / user info created in some subsystem and returned with file and line. At a higher level this error info is consumed, and provided file / line helps to understand from where this info was. Typically subsystem throws or return an error, but sometimes it is not suitable.