|
Boost : |
From: Dave Gomboc (dave_at_[hidden])
Date: 2001-11-27 12:44:29
> > No. Sometimes you need the types but you don't need the values.
Typelists
> > are distinct from tuples.
>
> They are distinct, no questions about it. Just like the type 'int' is
> distinct from the value '1', and sometimes I need the type int but not
the
> value 1.
>
> It seems quite intuitive - to me at least - for type lists to 'mimic'
> ordinary types, i.e. just like 1 is an instance of int, so will (1) be
an
> instance of (int) and (1 2) be an instance of (int int) (lisp notation
for
> brevity ;-) ).
>
> Not that I can't see some counter arguments to the above, of course.
But
> they aren't enough to make be abandon the idea.
What I am wondering (though this is not type-list specific) is if (1, 2,
3)
(a 3-tuple, all integers) will be type-incompatible to [1, 2, 3] (an
integer
list that happens to be length 3 at the moment). Explicit conversion
could
be fine, but implicit conversion between tuples and lists could be
dangerous
(partly by eroding compile-time type checking).
> Finally, I like the int2type<> and type2type<> names. They are
sufficiently
> obvious to me. I don't see a need to change them into *_identity.
I might be completely missing the point, but what's wrong with
typeof(foo)?
Dave Gomboc
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk