-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Deprecate erlang:get_stacktrace/1 #1783
Deprecate erlang:get_stacktrace/1 #1783
Conversation
Also eliminate use of erlang:get_stacktrace/0 in code generated by the ASN.1 compiler.
Those warnings don't make sense any more since erlang:get_stacktrace/0 is now deprecated.
6286380
to
ce550c9
Compare
Isn't it a bit too premature to deprecate |
Not sure I agree with the concern here, or rather, share it in the same way. First of all, I agree that this will make it pretty damn difficult for people to build patches that work on both on the day of the release, and you have to usually plan for a few days of adaptation while people communicate their workarounds -- which usually include optional compilation macros for each of them. For everyone, one option is to use the Overall the one thing this really forces is either for developers to all make libraries that support multiple versions of Erlang's compiler through macro-heavy use, and/or users to all have multiple Erlang/OTP versions installed in order to do their work. I'm happy to do that for the strings module (unicode support is important), but the stacktrace optimization is kind of a pain and I could imagine myself reducing the amount of debug information reported through logs to users in order to make compilation easier. I'm curious to see if the side-effect on Erlang operability will just find itself diminished by this change. What are the speed/safety benefits of this patch otherwise? Aside I'm also pretty bummed out at having to now go back through all my code (and the code in rebar3 is a particular pain point since we support 5 major OTP versions) and rework all of the try...catches by duplicating the functions that contain them (since we can't macro within a function body) just to handle the stacktrace portion. This, on the other hand, means that anyone with some backwards or forwards compat concerns that go larger than the OTP team will share that problem whether or not the deprecation warnings are kept for now or saved for later. I think there is just not a great cultural norm for this instilled in the Erlang community, and every change (see the I also have a backlog of like 15 changes of this kind to backport to LYSE and I have no time for at this point, and the accelerating pace of breaking changes does make it a lot harder to just not give up and force a rewrite, which I do not have a few years for, but yeah. |
Sorry to divert the conversation a bit further: would it be possible for you @ferd to publish LYSE's listings on github/gitlab, set up a CI & describe how people can contribute? I am sure people would be interested in contributing / discussing the contents of your (fantastic!) book(s)! |
Not really, because that gets to be tricky with the shared/Joint copyright with a publisher already. |
@michalmuskala Starting in OTP 20.1, there will not be a warning if
|
@ferd Perhaps a helper function could reduce the amount of duplicated code? For example:
There would still be a lot of code to change, but you would only have to provide two versions of |
This workaround ignores the ability of using |
I cannot build the ... ERLC ../ebin/xref_parser.beam compile: warnings being treated as errors /home/kostis/otp/bootstrap/lib/parsetools/include/yeccpre.hrl:60: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace /home/kostis/otp/make/aarch64-unknown-linux-gnu/otp.mk:124: recipe for target '../ebin/xref_parser.beam' failed make[3]: *** [../ebin/xref_parser.beam] Error 1 make[3]: Leaving directory '/home/kostis/otp/lib/tools/src' Is it just me? |
Relying on |
I had to manually remove the (generated) file A working, or at least better working, But I think that the root of the problem is that there are missing dependencies from the various Makefiles. |
Here's sample code of what working around the deprecation means: https://github.com/erlang/rebar3/pull/1773/files |
@ferd I am using a macro which makes it less painful:
That allows use like:
|
I actually have a third solution: https://github.com/fenollp/otp_vsn#on-st-matching :) |
@okeuday yeah I might revisit to use that pattern. I don’t like that all my code requires a big macro like that everywhere, but the reduction in code duplication is worth it |
Based off a macro by @okeuday at erlang/otp#1783
Based off a macro by @okeuday at erlang/otp#1783
It would have been useful if the |
@tomas-abrahamsson I agree, though I like the name |
On a related issue. What will |
It will return |
Thanks for the quick reply. It will be good if this change happens soon (i.e. now) so that applications that rely on this built-in for checking for OTP changes and/or incompatibilities (e.g. PropEr) can test 'master'/RC2 and adapt their code bases appropriately before 21.0 is released. |
If you checkout the tag itself and build from that the version numbers are correct. That is:
(If you'll need corrections not included in RC1, you could cherry-pick them.) |
Based off a macro by @okeuday at erlang/otp#1783
#1634 extended the
try/catch
syntax to retrieve the stacktrace.This pull request teaches the compiler to emit deprecation warnings for calls to
erlang:get_stacktrace/0
.