-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-198] Please coalesce #file, #line, #function, etc #42820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Comment by Andrew Bennett (JIRA) public struct SourceLocation: CustomDebugStringConvertible {
init(file: String = __FILE__, line: Int = __LINE__, column: Int = __COLUMN__, function: String = __FUNCTION__) {
self.file = file
self.line = line
self.column = column
self.function = function
}
public let file: String
public let line: Int
public let column: Int
public let function: String
public var debugDescription: String {
return "\(function) @ \(file):\(line):\(column)"
}
} |
Comment by Andrew Bennett (JIRA) Usage: let location = SourceLocation()
print("\(location)")
print("\(location.file)") |
Interesting, bnut (JIRA User). We could make this a library feature if the language rules for expanding |
Comment by Marc Knaup (JIRA) Wouldn't that result in the binary containing ALL information (file, line, column and function) even if I am only interested in a single item (e.g. just the line number)? I don't think that such a behavior would be desired. If that problem can be avoided then I'd like to also request two additional elements:
|
Additional Detail from JIRA
md5: d7dc4b9f9982a5639872d1a119a2cac7
Issue Description:
A single SOURCE_LOC struct could do the job nicely.
cite: http://twitter.com/jckarter/status/675418743221043201
The text was updated successfully, but these errors were encountered: