George
1
I have a use case where I want to capture location (#file, #line, #column) information and then propagate it through a few function calls. It is becoming a bit tedious to add file: StaticString = #file, line: Int = #line, column: Int = #column and initialize my custom struct (Location(file: file, line: line, column: column)) everywhere. I tried using a default initializer location: Location = .init(file: #file, line: #line, column: #column), but that uses the source location of the default initializer (which makes sense).
I'm wondering if there is some mechanism I can use to make this easier, for instance some attribute that means "use the source location of the outer calling function" . I thought there was something in the Standard Library, but I might be misremembering.
2 Likes
davedelong
(Dave DeLong)
2
3 Likes