# What do you think should be in OTP?

**URL:** <https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556>\
**Category:** Chat / Discussions\
**Tags:** community, otp\
**Created:** [November 13, 2021, 6:32pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556 "2021-11-13T18:32:26Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![lpil](https://erlangforums.com/user_avatar/erlangforums.com/lpil/32/222_2.png) [@lpil](https://erlangforums.com/u/lpil)\
**Post date:** [January 21, 2022, 3:34pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/82 "2022-01-21T15:34:54Z")

</div>

> [@meox](#):
>
> yes what I’m looking for is a simple way to use that macro/guards without reimplementing it over and over

Would a header file do? It’s quite common to have macros in header files. For example the ones for EUnit, for assertions, and for the logger.

---

<div class="post-metadata">

**Author:** ![LeonardB](https://erlangforums.com/user_avatar/erlangforums.com/leonardb/32/1856_2.png) [@LeonardB](https://erlangforums.com/u/LeonardB)\
**Post date:** [January 21, 2022, 4:12pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/83 "2022-01-21T16:12:55Z")

</div>

The functions you’re looking for are in the inet\_parse module that can easily be wrapped into a utility function

EG

```erlang
is_ipv4(Ip) when is_list(Ip) ->
  inet_parse:ipv4_address(Ip) =/= {error,einval};
is_ipv4(Ip) when is_tuple(Ip) ->
  is_ipv4(inet_parse:ntoa(Ip));
is_ipv4(Ip) when is_binary(Ip) ->
  is_ipv4(binary_to_list(Ip)).

```

Edit:  
IIRC, when a module/function in OTP is “undocumented” it should be treated as private/unstable.  
Maybe it’s time the IP parsing functions were documented/promoted

---

<div class="post-metadata">

**Author:** ![juhlig](https://erlangforums.com/user_avatar/erlangforums.com/juhlig/32/837_2.png) [@juhlig](https://erlangforums.com/u/juhlig)\
**Post date:** [January 21, 2022, 4:35pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/84 "2022-01-21T16:35:44Z")

</div>

> [@LeonardB](#):
>
> IIRC, when a module/function in OTP is “undocumented” it should be treated as private/unstable.  
> Maybe it’s time the IP parsing functions were documented/promoted

Yes, and they _do_ have equivalents in `inet` 😉 [`inet:parse_address/1`](https://www.erlang.org/doc/man/inet.html#parse_address-1) and friends.

Anyway… the conversion and parsing needed to use those functions for this purpose is pretty expensive I think 😅

---

<div class="post-metadata">

**Author:** ![vkatsuba](https://erlangforums.com/user_avatar/erlangforums.com/vkatsuba/32/314_2.png) [@vkatsuba](https://erlangforums.com/u/vkatsuba)\
**Post date:** [January 21, 2022, 6:50pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/85 "2022-01-21T18:50:49Z")

</div>

> [@meox](#):
>
> 3 new guards:
> 
> - is\_ip(IP): is\_ipv4(IP) orelse is\_ipv6(IP)
> - is\_ipv4(IP)
> - is\_ipv6(IP)

Oh yes, great idea - have possibilities to to set of custom guards if they are needed for project/lib/application 🕶

---

<div class="post-metadata">

**Author:** ![Maria-12648430](https://erlangforums.com/user_avatar/erlangforums.com/maria-12648430/32/604_2.png) [@Maria-12648430](https://erlangforums.com/u/Maria-12648430)\
**Post date:** [January 26, 2022, 11:34am UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/86 "2022-01-26T11:34:20Z")

</div>

FWIW: [Add IP checking functions to the inet module by Maria-12648430 · Pull Request #5646 · erlang/otp · GitHub](https://github.com/erlang/otp/pull/5646)

Not what @meox wanted (guards), but better than having to re-implement IP checks in user code 😉

---

<div class="post-metadata">

**Author:** ![maxlapshin](https://erlangforums.com/user_avatar/erlangforums.com/maxlapshin/32/1593_2.png) [@maxlapshin](https://erlangforums.com/u/maxlapshin)\
**Post date:** [August 13, 2022, 4:05am UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/87 "2022-08-13T04:05:18Z")

</div>

Maybe some well defined approaches for library dependency injection.

When I install third-party library, I do not want it to download another http client just because author had to do it. I want to provide some callback on application basic level.

It would be good to have it is a standard for community.

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 1:39pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/88 "2022-08-13T13:39:28Z")

</div>

- GUI: not always alpha/beta wx, but Tk or/and Qt

- lz4 (with lzhc) along with gzip/zlib

- not rebar3 but improved make/Emakefile build tool

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 3:40pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/89 "2022-08-13T15:40:27Z")

</div>

> JSON-RPC

Ugly JSON must die.

> BERT/BERT-RPC

Definitely no.

---

<div class="post-metadata">

**Author:** ![vkatsuba](https://erlangforums.com/user_avatar/erlangforums.com/vkatsuba/32/314_2.png) [@vkatsuba](https://erlangforums.com/u/vkatsuba)\
**Post date:** [August 13, 2022, 3:55pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/90 "2022-08-13T15:55:54Z")

</div>

Interesting statements 🙃.  
`Ugly JSON must die.` - Why? Alternatives?  
`Definitely no.` - Why?

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:03pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/91 "2022-08-13T16:03:04Z")

</div>

> [@meox](#):
>
> 3 new guards:
> 
> - is\_ip(IP): is\_ipv4(IP) orelse is\_ipv6(IP)
> - is\_ipv4(IP)
> - is\_ipv6(IP)

Guards? Yes, I agree that  
`is_ipv4(A) -> is_binary(A) andalso inet:parse_ipv4strict_address(binary_to_list(A)) =/= {error, einval}.`  
is too bulky (especially beacouse binary\_to\_list/1), but guard, really?

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:07pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/92 "2022-08-13T16:07:32Z")

</div>

> `Ugly JSON must die.` - Why?

Because it’s ugly and stupid

> Alternatives?

term\_to\_binary/1,2  
message pack  
cbor

> `Definitely no.` - Why?

Because it’s obsoleted and term\_to\_binary/1,2 faster and better.

---

<div class="post-metadata">

**Author:** ![vkatsuba](https://erlangforums.com/user_avatar/erlangforums.com/vkatsuba/32/314_2.png) [@vkatsuba](https://erlangforums.com/u/vkatsuba)\
**Post date:** [August 13, 2022, 4:16pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/93 "2022-08-13T16:16:06Z")

</div>

Well the `BERT` is use in the background `term_to_binary` 🙃 - of course this is related to the implementation but in any case it is used. About `Because it’s ugly and stupid` not sure that this is a good explanation 🙃. Any examples what is made you think so?

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:23pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/94 "2022-08-13T16:23:44Z")

</div>

Because term\_to\_binary/1,2 cover all erlang type, cbor can cover all erlang types, MessagePack cover most of erlang types. And JSON is ugly and stupid (and yes, also according to js-developers).

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:24pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/95 "2022-08-13T16:24:56Z")

</div>

> `BERT` is use in the background `term_to_binary`

No, it don’t.

---

<div class="post-metadata">

**Author:** ![vkatsuba](https://erlangforums.com/user_avatar/erlangforums.com/vkatsuba/32/314_2.png) [@vkatsuba](https://erlangforums.com/u/vkatsuba)\
**Post date:** [August 13, 2022, 4:29pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/96 "2022-08-13T16:29:29Z")

</div>

> [@Led](#):
>
> (and yes, also according to js-developers)

Interesting. But without `js-developers` you could not join and communicate in such a great forum as this one. I’m already silent about thousands of other useful resources.

`No, it don’t.` Hm… Yep it is used [bert.erl/src/bert.erl at master · mojombo/bert.erl · GitHub](https://github.com/mojombo/bert.erl/blob/master/src/bert.erl#L20) 🙃 and should be used, because `BERT` means `Binary ERlang Term` 😉 - so, without `term_to_binary` outside this will not works.

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:34pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/97 "2022-08-13T16:34:47Z")

</div>

> But without `js-developers` you could not join and communicate in such a great forum as this one.

I meant “js-developers also think JSON is ugly and stupid” (AFAIK).

---

<div class="post-metadata">

**Author:** ![vkatsuba](https://erlangforums.com/user_avatar/erlangforums.com/vkatsuba/32/314_2.png) [@vkatsuba](https://erlangforums.com/u/vkatsuba)\
**Post date:** [August 13, 2022, 4:36pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/98 "2022-08-13T16:36:32Z")

</div>

> [@Led](#):
>
> I meant “js-developers also think JSON is ugly and stupid” (AFAIK).

Oh… my bad. Misunderstanding. Sorry.

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:37pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/99 "2022-08-13T16:37:53Z")

</div>

> Yep it is used [bert.erl/bert.erl at master · mojombo/bert.erl · GitHub](https://github.com/mojombo/bert.erl/blob/master/src/bert.erl#L20)

I can’t find maps and atoms there:)

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [August 13, 2022, 4:40pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/100 "2022-08-13T16:40:04Z")

</div>

> Oh… my bad. Misunderstanding. Sorry.

Or my bad:) My English far from perfect, sorry:)

---

<div class="post-metadata">

**Author:** ![vkatsuba](https://erlangforums.com/user_avatar/erlangforums.com/vkatsuba/32/314_2.png) [@vkatsuba](https://erlangforums.com/u/vkatsuba)\
**Post date:** [August 13, 2022, 4:53pm UTC](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556/101 "2022-08-13T16:53:20Z")

</div>

> [@Led](#):
>
> I can’t find maps and atoms there:)

You see I believe that this is a pet project which was experimental. But in this implementations is used some terms like `lists`, `tuples`, `maps`, you can find it in the logic in the [encode\_term/1](https://github.com/mojombo/bert.erl/blob/master/src/bert.erl#L32) and [decode\_term/1](https://github.com/mojombo/bert.erl/blob/master/src/bert.erl#L53). Perhaps the project is far from ideal, I saw more interesting implementations somewhere - but this may push us to implement something more impressive implementation.

[Previous page](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556.md?page=4)

[Next page](https://erlangforums.com/t/what-do-you-think-should-be-in-otp/556.md?page=6)
