immutable benefits

Henning Diedrich hd2010@REDACTED
Wed May 12 20:34:06 CEST 2010


Another hoping for magic.

Is it possibly the case that Erlang will not copy anything from 
ColumnNamesBinary in the following example but simply have an internal 
representation of two pointers for each of the resulting 'Name' 
binaries, which pointers would point into ColumnNamesBinary, to the 
beginning of each respective individual name, and to its end? (Or using 
a length instead).

        ColumnNames = [ Name || <<Size:16, Name:Size/binary>> <=
        ColumnNamesBinary ].

Just asking since I could imagine that this could be the case to save a 
lot of space and performance.

I thought the immutability of variables may allow for this strategy. 
Although I would imagine that garbage collection may severely hampered 
by such a strategy.

Thanks for letting us know,
Henning




More information about the erlang-questions mailing list