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