August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | One question, wasn't the fact that "template Test(T...)" can accept literals as well as types originally a bug? Or am I thinking of "template Test(alias T)"? |
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On Thursday, 22 August 2013 at 15:01:23 UTC, Meta wrote:
> One question, wasn't the fact that "template Test(T...)" can accept literals as well as types originally a bug? Or am I thinking of "template Test(alias T)"?
Well it is necessity that comes from the fact that it denotes "variadic template argument list". If this is legal (and it is):
template Test(int N, T) { }
than variadic list must accept both too.
|
August 23, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On 08/22/13 16:57, Dicebot wrote:
> On Thursday, 22 August 2013 at 14:39:59 UTC, Jakob Ovrum wrote:
>> I don't think it's correct or useful to label one as compile-time and the other as runtime. I think the mutability or immutability of the expression tuple is an obvious result of its lvalue-ish or rvalue-ish nature, respectively. As such - with the current semantics - I'm not sure it's important to be able to easily distinguish the two. I'd be happy to be convinced otherwise if you think it's important.
>
> I don't know either :) I am just trying to find some order in existing scheme. What frustrates me most in expression sequences being both runtime and compile-time is that compile-time still can act as if they are almost types:
>
> alias a = TypeTuple!(1, 2); // ok
> auto b = TypeTuple!(1, 2); // also ok!
>
> Isn't it the only entity in the whole language that can be used in type context (alias) and value context (initializer) at the same time?
It's not a "type context". That alias declaration only creates another
name ("alias").
int v;
alias a = v;
auto b = v;
Which btw means that introducing /just/ a new tuple syntax w/o other changes would make the equivalent of that first 'a' declaration illegal, for the same reasons that make
alias c = 1;
not valid right now. But allowing literals here shouldn't be a problem (allowing /all/ rvalues would be, at least w/o a working lifetime system).
artur
|
August 23, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 21 August 2013 at 17:53:21 UTC, Andrei Alexandrescu
wrote:
> There's an inordinate amount of confusion around what we currently call "type tuple" (embodied in std's TypeTuple). I've been furious immediately as I got word that Walter called it that way, and it hasn't failed to make everybody else feel the same over the years.
>
> So: shall we use "template pack" going forward exclusively whenever we refer to that stuff? That way we can unambiguously use "tuple" for "value tuples, i.e. like mini-structs that group values together".
>
> Destroy. I mean criticize.
>
>
>
> Andrei
The minimal name change would be:
TypeSystemTuple (or is that TypesystemTuple?).
Inside the type system, it is actually a tuple. It's implemented
as a tuple inside the compiler, which is why Walter probably gave
it that confusing name in the first place. It's a tuple in the
compiler world, but that is not exactly the same as a tuple in
the programmer's world. The fact that it is a tuple inside the
compiler, is the reason that it shares so many characteristics
with tuples.
It is a tuple of type system entities (which does include things
other than types). You can use that to create a run-time tuple.
|
Copyright © 1999-2021 by the D Language Foundation