문제

New function of ets gives back a integer instead of atom

    1> A=ets:new(hello,[set]).
       126999
도움이 되었습니까?

해결책

ets:new/2 is supposed to return a table identifier of typ tid(). That identifier should be sent to other ets functions to tell what table you are working on.

The identifier now happens to be an integer, but you should not count on that (you cannot add two identifiers together, for example). Only ever use it as an ETS table identifier.

다른 팁

It returns an identifier whose type is not defined, currently an integer. If you create a named table then the identifier will be an atom which is its name. So for example:

1> A = ets:new(hello, [set,named_table]).
hello.
2> A.
hello

The table name can now be used as its identifier. This is similar to "naming" processes by registering them.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top