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

OTP_RELEASE: incorrect documentation? #8486

Closed
rlipscombe opened this issue May 16, 2024 · 1 comment · Fixed by #8518
Closed

OTP_RELEASE: incorrect documentation? #8486

rlipscombe opened this issue May 16, 2024 · 1 comment · Fixed by #8518
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@rlipscombe
Copy link
Contributor

rlipscombe commented May 16, 2024

Describe the bug

In https://www.erlang.org/doc/reference_manual/macros, ?OTP_RELEASE is documented as:

The OTP release that the currently executing ERTS application is part of, as an integer.

However, after experimenting, this macro appears to be the version of OTP used to compile (not execute) the current source file.

To reproduce:

#!/bin/sh

mkdir -p ebin

source ~/.kerl/erlangs/OTP-25.3.2.11/activate
erlc -o ebin src/otp_25.erl

source ~/.kerl/erlangs/OTP-26.2.5/activate
erlc -o ebin src/otp_26.erl

source ~/.kerl/erlangs/OTP-27.0-rc2/activate
erlc -o ebin src/otp_27.erl
-module(otp_25). % or _26, _27, as appropriate
-export([info/0]).

info() ->
    ?OTP_RELEASE.
% erl -pa ebin
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Eshell V14.1.1 (press Ctrl+G to abort, type help(). for help)
1> otp_25:info().
25
2> otp_26:info().
26
3> otp_27:info().
27

Does the documentation need to be corrected, or am I missing something?

@rlipscombe rlipscombe added the bug Issue is reported as a bug label May 16, 2024
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label May 20, 2024
@bjorng bjorng linked a pull request May 28, 2024 that will close this issue
@bjorng
Copy link
Contributor

bjorng commented May 28, 2024

Yes, the documentation could be clearer. What is meant is that the OTP release that is running the compiler is returned. I have tried to make it a little bit clearer in the linked pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants