Reason for name parameter in ets:new for unnamed tables

Viewed 167

Looking at the documentation for ets:new I see that the Name parameter is mandatory. Also when the options contain named_table, the function will return the Name instead of the table identifier, which is then used to access the table.

However, when the table is not named, what is the Name parameter good for? Why is it mandatory? Do I ever use it after the table has been created? Isn't the table identifier used instead of the name then?

What is the purpose of the Name when the table is not named?

1 Answers

This is a common practice in ; for unnamed tables Name is simply ignored.

The clause new(Options) -> tid() | atom() for unnamed tables would require the additional check whether Options do not contain named_table now, the existing arity 2 function would require the alternative check for named_table is passed etc.

This all brings unnecessary complexity for no value.

Related