Skip to content
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

--import:libbacktrace, -g and --stacktrace:off shouldn't be needed #12

Open
timotheecour opened this issue Mar 14, 2021 · 5 comments
Open

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Mar 14, 2021

nimStackTraceOverride should be usable with a single switch.
this works:

nim r --import:libbacktrace -d:nimStackTraceOverride -g main.nim

but is not ideal because libbacktrace gets imported everywhere

adding explicit import libbacktrace is also not ideal because it requires changing source file

proposal

  • make -d:nimStackTraceOverride cause an import libbacktrace where it's neeed (probably a single file in nim repo)

if this needs compiler support, it's still worth it.

  • furthermore, -g should be implied by -d:nimStackTraceOverride
  • ditto with --stacktrace:off

we can also add: --stacktrace:libbacktrace nim flag to make it more official

(this may require fixing in nim repo instead of here, but let's keep this open until this is fixed, I can also look into it)

note

@timotheecour timotheecour changed the title --import:libbacktrace shouldn't be needed --import:libbacktrace and -g shouldn't be needed Mar 14, 2021
@timotheecour timotheecour changed the title --import:libbacktrace and -g shouldn't be needed --import:libbacktrace, -g and --stacktrace:off shouldn't be needed Mar 14, 2021
@stefantalpalaru
Copy link
Contributor

I find it extremely hard to get changes into the Nim compiler repo, so I would prefer not to depend on them.

@timotheecour
Copy link
Contributor Author

timotheecour commented Mar 14, 2021

times have changed :) if nimStackTraceOverride is getting mature enough to the point that it's a reliable more efficient alternative, it's IMO entirely justifiable. I can look into it.

@arnetheduck
Copy link
Member

times have changed :) if nimStackTraceOverride is getting mature enough to the point that it's a reliable more efficient alternative, it's IMO entirely justifiable. I can look into it.

the longer-term issue remains that the compiler is often the wrong place to fix things: a monolith is inefficient to work with because you get too few changes when you want them and too many when they arrive - it doesn't help that more cruft gets added to it for every release, that only makes it harder to upgrade.

@arnetheduck
Copy link
Member

libbacktrace is an excellent example: newer compiler versions are too buggy to be upgraded to, which has prevented us from fully exploiting libbacktrace for more than a year - ideally, the compiler could become smaller and would have a way to upgrade individual, independent components without requiring to upgrade everything - I hope this is what you mean when you say that you'll look into it.

@timotheecour
Copy link
Contributor Author

ideally, the compiler could become smaller and would have a way to upgrade individual, independent components without requiring to upgrade everything

it's not that simple, splitting a mono-repo brings its own set of issues around synchronization, communication, stable interfaces, etc which add friction to development. D splits phobos and dmd which adds a lot of friction and complexity when a patch affects both. For some features where there's a clear boundary it makes complete sense, like splitting doc-gen into 2 parts: a part where compiler generates an IR (eg json), and a part that reads this IR to do rst parsing and html/latex generation.

Back to this issue, I'm not advocating for merging nim-libbacktrace into nim, but for enabling it via a single flag (as described in top-post) and without causing an implicit import on each compiled module. It's doable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants