Domanda

New function of ets gives back a integer instead of atom

    1> A=ets:new(hello,[set]).
       126999
È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top