Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2001-11-26 11:25:43


From: "Geurt Vos" <G.Vos_at_[hidden]>
> Can anyone explain why the members of the type list
> template are called 'head' and 'tail'? I mean the
> type list template is merely a node in a linked list
> of types, where 'head' represents the content of the
> node, and 'tail' points to the next node.

Typelists are much like well-formed LISP-lists, in which "head" is an
"atomic type" (non-typelist) and tail is actually another list, or nil. So
"next" would not be a good choice. Besides, head and tail are quite
consecrated for denoting this type of list.

I don't think anyone would have liked 'car' and 'cdr' :o).

> Also, given (the fact) that for many it is tough
> enough to grasp the concept of type lists and the
> difference between compile-time or run-time, I think
> using 'head' and 'tail' could cause confusion.
> People could think they meant 'head of the list' and
> 'tail of the list' as in begin()/end().

That's a good argument, but then what choice would be more sensible?

> Lastly, type_list_node<> instead of type_list<>?

Lists are nodes and vice versa... by the way it's typelist not type_list.

Andrei


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk