How to enable maybe_expr?

Hello everyone,

I’m trying enable maybe feature on my project, but always get the error:

{features_not_allowed, [maybe_expr,maybe_expr]}

I’m using rebar3 and OTP 25.1.2 in my project and tried some things to enable the feature.

I tried to add in rebar.config:

{erl_opts, [debug_info, 
            {parse_transform, lager_transform},
            {feature, maybe_expr, enable}]}.

and add in my_module.erl:

-feature(maybe_expr, enable).
-compile({feature, maybe_expr, enable}).

and add in vm.args:

-enable-feature maybe_expr

But I’but I was not successful with any option. To start I just run rebar2 shell on the project.

Thanks!

2 Likes

I usually do it that way, but you need to set the path to vm.args when calling rebar3 commands.
So, if vm.args is at config/vm.args (relative to current directory), you can run it with: env ERL_FLAGS="-args_file config/vm.args" rebar3 <command> ... (assuming you’re using some linux, not sure this would work on Windows)

1 Like