Hacker Newsnew | past | comments | ask | show | jobs | submit | yaglo's commentslogin

Because they swapped some characters like \ to /, if I remember correctly.


1. Every class/method/function/whatever declaration is an API, doesn't matter if it's internal or which language it's written. 2. Why do you think it's better? It looks like it tries to cater to everyone, and leads to inconsistent API usage and requires teams to agree on linting rules and use tools to enforce consistent coding standards. 3. It's a tool for _you_ to design good APIs that are clear. Languages without named arguments don't give you this tool.

> So does renaming a label.

In languages without this feature, any renaming breaks the API, unlike the ones with distinct internal and external names. This is not the same.


Within Xcode, you don’t really need it because you’re already running with a debugger when you launch your program.


Yeah, but when the problems go into the API or the Swift Library, things get real murky. The dumps from Xcode can be damn near useless.


Yes, you can evaluate Swift code in LLDB. See https://stackoverflow.com/a/71882942


The best part of is that you can get all this goodness even without having Swift code in your codebase.

Just link your C++ (or whatever) project with The Swift runtime (swiftrt.o and libswiftCore.so), and there you have it without writing any Swift.


Looks like <stacktrace> is already part of C++23 [0]. But if you must use an older C++, why link the entire Swift runtime rather than something GCC's builtin backtraces [1] or libbacktrace [2]?

[0] https://www.sandordargo.com/blog/2022/09/21/cpp23-stacktrace...

[1] https://www.gnu.org/software/libc/manual/html_node/Backtrace...

[2] https://github.com/ianlancetaylor/libbacktrace


If you're on the Mac, your process is probably linking the Swift runtime anyway. Foundation.framework is being reimplemented in Swift, so if your process links Foundation (or even just CF), you've got the Swift runtime.


It’s a nicer experience during development out of the box, without having to do anything manually.

Swift Backtracing is not only about the symbols, it’s also interactive and lets you attach the debugger after the process crashes, which is neat.


I don't think <stacktrace> is async signal safe, and thus shouldn't be used for in-process crash reporting.


If you're on mac (where I assume the two are already available), what compiler flags need to be passed in to do this?


$ clang++ foo.cpp -o foo -framework Foundation

-lswift_Backtracing also works, but dunno if that's "public API"

$ codesign --force --sign - --entitlements entitlements.plist foo

https://github.com/apple/swift/blob/main/docs/Backtracing.rs...

$ SWIFT_BACKTRACE="enable=yes" ./foo

Very cool!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: