Leo
Leo

Reputation: 1760

list_to_atom Failed Caused by System Limitation in Erlang

I tried to compile a asn file with Erlang's asn1ct:compile function. I run the following code:

asn1ct:compile("PDU-definitions", [per, verbose]).

then got the following errors:

...
{error,{system_limit,[{erlang,list_to_atom,
            ["enc_InterRATHandoverInfo_v390NonCriticalExtensions_present_v3a0NonCriticalExtensions_laterNonCriticalExtensions_v3g0NonCriticalExtensions_v4b0NonCriticalExtensions_v4d0NonCriticalExtensions_v590NonCriticalExtensions_v690NonCriticalExtensions_nonCriticalExtensions"],           []},
...

I googled and found there's a 255-character length limitation of Erlang's atom. Because there are too many nested data structure in the ASN file, the length of corresponding atom exceed the limitation.

My question is: if I can modify the default length limitation to a bigger value, or there are some workarounds for this situation?

Thanks!

Upvotes: 1

Views: 216

Answers (1)

Soup in Boots
Soup in Boots

Reputation: 2392

As of R17, there remains no way to modify the maximum character limit in Erlang outside of modifying the source and recompiling. A sparse look at asn1ct's documentation suggests no means of changing the atom-encoding behaviour, either.

Best bet that I saw was the "n2n" option of compiling, which instructs the compiler to generate functions for doing name-to-enumeration conversion. I assume that it will still construct atoms in this case, however, which would be a moot point.

Nothing else in the documentation suggests a way to change name-construction behaviour, and as such severely nested data structures will cause problems.

Upvotes: 1

Related Questions