Cannot use :counters.new in elixir 1.8-otp-21 with erlang 21.0

Background

I have a project using the latest versions of elixir and erlang and I am using asdf as a versions manager. I have a project with a .tool-versions file that has the following:

elixir 1.8-otp-21
erlang 21.0

Problem

In theory, when using a terminal inside the project’s folder and launching iex, I should be able to use the new :counters module from erlang.

However I am greeted with the following message instead:

** (UndefinedFunctionError) function :counters.new/2 is undefined (module :counters is not available)
:counters.new(1, )

What am I doing wrong? Do I need to launch iex with special flags or something?

The :counters module was added in Erlang 21.2 it seems, so it would not exist in 21.0.

5 Likes

Where did you find this? I couldn’t find a reference in the official docs:

http://erlang.org/doc/man/counters.html#new-2

Because we are used to delve into changelogs when something isn’t found in the currently used version.

Erlang sadly does not include this information into the documentation directly.

5 Likes

In fact I used DuckDuckGo to search for “otp counters module” and there was a page titled “Otp 21.2” in the search results. :slight_smile:

Also may I just say, I like how you format your topics on the forum with the subtitles, they are very clear to read!

3 Likes

So interesting! The first person I find who actually knows about a search engine that is not Google, let alone uses it! (iirc, DuckDuckGo uses google beneath the sheets, but who cares!)

Are you a Linux Mint user? I remember it was the default search engine a few years ago :stuck_out_tongue:
Also, thank you for the appreciation, it feels nice to have some from time to time! (I usually get battered in the forums for my ignorance :stuck_out_tongue: )

Rather interesting and it gave an idea for yet another discussion :stuck_out_tongue:

Because I’m under the same believe, I tend to not use it, but ask google directly, as it knows what kind of cucmber I am asking for and also includes interlingua results despite the fact that only the localized version of the word appears in the article.

If though I’m searching for operators or functions, I tend to use symbolhound.

1 Like

AFAIK DDG does not use Google index, they have their own index and they use several other sources, including Bing. I started using it because of my aversion to Google knowing everything about me and I found it works very well for me.

Sometimes I need Google’s results, in those cases I use StartPage which searches Google for me but privately.

I’m not a Mint user, I mostly use macOS for daily things and programming, Linux systems on my servers, and Windows for gaming.

4 Likes

Hey, some of us use DDG and StartPage for years. :slight_smile:

1 Like

In OTP 21.3, this information will be included.

As an example, here’s how the counters documentation will look like in OTP 21.3.

9 Likes

I like it!

Will the information available everywhere or only for recently added modules and functions?

A very much needed change. Thank you!

It will be available everywhere. The information will go back to R13B04. Functions or modules added before that will not have any version information.

BTW, here is the pull request that introduced versions in documentation.

7 Likes

I think this should be far back enough. For my use cases even 18.0 had been enough, as I rarely need to look back thus far…

2 Likes

Amazing initiative. You guys are unbelievably awesome. Thanks for that chage!

3 Likes