On Tue, 2008-12-02 at 08:50 +0100, Carl Mäsak wrote:
> Darren (>):
> > Bit
> > Blob
> > Set
> > Bag
> > Mapping
> > How does one write anonymous value literals of those types? And I mean
> > directly, not by writing a literal of some other type and using a conversion
> > function to derive the above?
> Why is the latter method insufficient for your needs?
Efficiency reasons, among others. We can quibble over the syntax, but
it would be awfully nice if implementations were able to generate the
data structure as early as possible -- at compile time (for literals
containing only constants) or during runtime as a single build pass
rather than build-other-type-then-convert (for literals containing
If there isn't an easy way for the implementation to make this
optimization, then we're stuck with some of the "basic" types taking
twice the time and space to create that other similar types do, for no
good reason. Mind you, some implementations may get "lucky" by using a
common all-powerful collection implementation underneath, and turning
the "conversion" into a simple type relabel (constant cost in time and
space), but that doesn't generalize to highly-tuned implementations that
optimize each collection type's data structures individually.