Improper lists [was: Dialyzer v1.3.0 released]
Tue Mar 29 11:34:25 CEST 2005
--- James Hague <james.hague@REDACTED> wrote:
> Thomas Lindgren wrote:
> >So storing a pair as a cons saves 33% memory. Also,
> >it's generally somewhat faster to access conses
> >tuples :-)
> In theory you could have a special type tag for "two
> element tuple"
> (and even three and four elements, depending how far
> you want to go),
> so there would be no benefit to storing a pair as a
> cons. The
> tradeoff is that that you have to handle those new
> type tags all over
> the place in the runtime, of course.
Yeah, nothing really prevents that (apart from a small
matter of implementation :-)
The data representation itself is basically just a big
trade-off, one which is deemed to be reasonably fast
and compact for most Erlang programs and not too
difficult to work with in the runtime system.
(For an overview of various alternatives for Erlang,
take a look at Mikael Petterson's report. I believe
his tag scheme is the one in use nowadays.
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
More information about the erlang-questions