[phobos] Fwd: Tuple, TypeTuple, tupleof etc
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 12 11:13:03 PDT 2010
On Tuesday, October 12, 2010 09:30:29 Shin Fujishiro wrote:
> Here's my thoughts.
>
> Tuple should be kept as-is. But TypeTuple and tupleof should be
> renamed meta.Sequence and fieldsof, respectively. These names are
> better because they reflect facts more precisely. Let's see why I
> think so.
>
> std.typecons' Tuple should be kept. A Tuple instance packs several
> run-time values in a single entity - it's really what called a tuple.
> So, the name should be kept as is.
>
> On the other hand, TypeTuple should be renamed meta.Sequence due to
> its peculiar nature... (a) It can contain anything but run-time values,
> and (b) it automatically expands by itself. You can even use
> TypeTuples for filling array literals and function arguments. They're
> more like flat sequences of compile-time entities than packed tuples.
>
> Also, the built-in tupleof property should be renamed. It's just a
> misnomer... It presents a run-time sequence of the all fields of an
> aggregate object, not a tuple of the aggregate. (what's that?) The
> name should be more intuitive and straightforward: fieldsof.
>
> To sum up, I think we should take these actions:
>
> 1. Leave Tuple as is;
> 2. Deprecate TypeTuple with meta.Sequence; and
> 3. Deprecate tupleof with fieldsof.
>
> The proposed nomenclature reflects the facts around the "three tuples"
> more precisely, and there's no confusion. What do you think?
>
>
> P.S. Ah... maybe meta.Sequence can be replaced with the hot craze
> "tuple literals" if they can contain types and symbols. Sure, I'll be
> happy if so! (But they should be called sequence literals... ;-))
I'm not sure if your exact names are the best (though they seem reasonably
good), but I completely agree that renaming TypeTuple and tupleof to something
other than tuple would be an excellent move. As they are, it's very easy to
confuse them with Tuple, and it can cause a fair bit of headache to try and
figure out what the differences are. And while they _are_ tuples of a sort,
they're very limited in both representation and useage, so calling them tuples
is at least somewhat misleading.
- Jonathan M Davis
More information about the phobos
mailing list