# How to enable maybe\_expr?

**URL:** <https://erlangforums.com/t/how-to-enable-maybe-expr/2154>\
**Category:** Questions / Help\
**Tags:** maybe, feature\
**Created:** [December 10, 2022, 6:25pm UTC](https://erlangforums.com/t/how-to-enable-maybe-expr/2154 "2022-12-10T18:25:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardobocchi](https://erlangforums.com/user_avatar/erlangforums.com/ricardobocchi/32/974_2.png) [@ricardobocchi](https://erlangforums.com/u/ricardobocchi)\
**Post date:** [December 10, 2022, 6:25pm UTC](https://erlangforums.com/t/how-to-enable-maybe-expr/2154/1 "2022-12-10T18:25:11Z")

</div>

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`:

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

```

and add in `my_module.erl`:

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

```

and add in `vm.args`:

```erlang
-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!

---

<div class="post-metadata">

**Author:** ![mmin](https://erlangforums.com/user_avatar/erlangforums.com/mmin/32/2193_2.png) [@mmin](https://erlangforums.com/u/mmin)\
**Post date:** [December 10, 2022, 6:50pm UTC](https://erlangforums.com/t/how-to-enable-maybe-expr/2154/2 "2022-12-10T18:50:27Z")

</div>

> [@ricardobocchi](#):
>
> `-enable-feature maybe_expr`

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)

---

<div class="post-metadata">

**Author:** ![p-kraszewski](https://erlangforums.com/user_avatar/erlangforums.com/p-kraszewski/32/1983_2.png) [@p-kraszewski](https://erlangforums.com/u/p-kraszewski)\
**Post date:** [June 7, 2023, 7:05am UTC](https://erlangforums.com/t/how-to-enable-maybe-expr/2154/3 "2023-06-07T07:05:46Z")

</div>

Hello!

Does it interact with `{relx,[{release,..,[{vm_args,...}]}]}` in any way?

Or is it (as I understand)

- `ERL_FLAGS="-args_file config/vm.args" rebar3 ...` dev-only (compile, dialyzer, eunit, etc)
- `{relx,...,{vm_args,...}}` production-only (release)?

* * *

EDIT: is there any way to force this config in some **project-local** configuration file? I understand you can’t set it from within `rebar.config`, because it needs to set a flag on BEAM itself, which is already running when processing `rebar.config`.

---

<div class="post-metadata">

**Author:** ![mmin](https://erlangforums.com/user_avatar/erlangforums.com/mmin/32/2193_2.png) [@mmin](https://erlangforums.com/u/mmin)\
**Post date:** [June 7, 2023, 10:53am UTC](https://erlangforums.com/t/how-to-enable-maybe-expr/2154/4 "2023-06-07T10:53:19Z")

</div>

> [@p-kraszewski](#):
>
> is there any way to force this config in some **project-local** configuration file?

AFAIK no.  
Note that starting from OTP 26.0 [you don’t need to explicitly enable feature in the runtime via `vm.args`, it is enough to enable it in the compiler](https://www.erlang.org/blog/otp-26-highlights/#no-need-to-enable-feature-maybe-in-the-runtime-system)

---

<div class="post-metadata">

**Author:** ![p-kraszewski](https://erlangforums.com/user_avatar/erlangforums.com/p-kraszewski/32/1983_2.png) [@p-kraszewski](https://erlangforums.com/u/p-kraszewski)\
**Post date:** [June 7, 2023, 12:05pm UTC](https://erlangforums.com/t/how-to-enable-maybe-expr/2154/5 "2023-06-07T12:05:05Z")

</div>

Yes. [Additionally](https://www.erlang.org/doc/general_info/upcoming_incompatibilities.html), starting from OTP-27 will be default on (“Approved”) and starting from OTP-29 will be always-on (“Permanent”).

My problem is

```erlang
> pkg info erlang
erlang-25.3.1,4

```

and FreeBSD being slowly moving target.

I just globally added `'-enable-feature maybe_expr'` to `ERL_FLAGS`. I hope it won’t cause any hiccups.

Thank you for your time.
