November 01, 2020
On Saturday, 31 October 2020 at 23:09:31 UTC, Manu wrote:
> [..]
>
> Is "Alias Sequence" present in spec language?


https://dlang.org/articles/ctarguments.html
November 01, 2020
On Saturday, 31 October 2020 at 23:09:31 UTC, Manu wrote:
>
> Is "Alias Sequence" present in spec language?
> This really demonstrates how much D needs first-class tuples; this area of
> the language is a shit-fight, and essentially just a weird abuse of
> template argument lists mixed with `alias` and some implementation defined
> behaviour, which happens to look and feel a lot like a tuple.

If tuples, tuple unpacking, compile time sequences et al. could be rationalised down to a simpler tuple concept (from the developer POV) then this would be "most marvelous" simplification.

I have absolutely no idea if that is even vaguely possible, but it sounds great.
November 01, 2020
On Saturday, 31 October 2020 at 23:09:31 UTC, Manu wrote:
> On Sat, Oct 31, 2020 at 12:05 PM Paul Backus via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
> Is "Alias Sequence" present in spec language?
> This really demonstrates how much D needs first-class tuples; this area of
> the language is a shit-fight, and essentially just a weird abuse of
> template argument lists mixed with `alias` and some implementation defined
> behaviour, which happens to look and feel a lot like a tuple.

tuples already exists in other languages, in math / set theory, it's already a fairly well established idea and it seems a bit weird for D to invent its own name for what's essentially the same thing.

To me "alias sequence" is an implementers name, it's named for how it's implemented not for the actual concept.

It's like "when you see enum think manifest constant"

"When you see AliasSeq think tuple"

Or if instead of lambdas D decided to have "alias functions"...

arrghh
November 01, 2020
On Sunday, 1 November 2020 at 10:15:44 UTC, claptrap wrote:
> To me "alias sequence" is an implementers name, it's named for how it's implemented not for the actual concept.

Yes, but tuples should have struct semantics, and structs hold values, not aliases.

Anyway, this would all become moot if the ... operator was designed to work with all static length objects that provide index-access and .length.

November 01, 2020
On Sunday, 1 November 2020 at 10:45:48 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 1 November 2020 at 10:15:44 UTC, claptrap wrote:
>> To me "alias sequence" is an implementers name, it's named for how it's implemented not for the actual concept.
>
> Yes, but tuples should have struct semantics, and structs hold values, not aliases.

Why should they? Why cant a tuple hold aliases? That's essentially what AliasSeq is isnt it?

I mean you shouldn't have to use arrays at run time and then entitylist at compile time, just because its holding something CT only. An array is an array.

Maybe Im being naive or idealistic though.
November 01, 2020
On Sunday, 1 November 2020 at 14:35:21 UTC, claptrap wrote:
> Why should they? Why cant a tuple hold aliases? That's essentially what AliasSeq is isnt it?
>
> I mean you shouldn't have to use arrays at run time and then entitylist at compile time, just because its holding something CT only. An array is an array.

That's a good question, I guess you might hold aliases too now that you mention it.

struct { int _0=42; alias _1=T; int length=2 }

I guess you can. Hm.



November 01, 2020
On 11/1/20 5:15 AM, claptrap wrote:
> On Saturday, 31 October 2020 at 23:09:31 UTC, Manu wrote:
>> On Sat, Oct 31, 2020 at 12:05 PM Paul Backus via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>> Is "Alias Sequence" present in spec language?
>> This really demonstrates how much D needs first-class tuples; this area of
>> the language is a shit-fight, and essentially just a weird abuse of
>> template argument lists mixed with `alias` and some implementation defined
>> behaviour, which happens to look and feel a lot like a tuple.
> 
> tuples already exists in other languages, in math / set theory, it's already a fairly well established idea and it seems a bit weird for D to invent its own name for what's essentially the same thing.

It isn't the same thing.

November 01, 2020
On Sunday, 1 November 2020 at 16:37:19 UTC, Andrei Alexandrescu wrote:
> On 11/1/20 5:15 AM, claptrap wrote:
>> On Saturday, 31 October 2020 at 23:09:31 UTC, Manu wrote:
>>> On Sat, Oct 31, 2020 at 12:05 PM Paul Backus via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>>> Is "Alias Sequence" present in spec language?
>>> This really demonstrates how much D needs first-class tuples; this area of
>>> the language is a shit-fight, and essentially just a weird abuse of
>>> template argument lists mixed with `alias` and some implementation defined
>>> behaviour, which happens to look and feel a lot like a tuple.
>> 
>> tuples already exists in other languages, in math / set theory, it's already a fairly well established idea and it seems a bit weird for D to invent its own name for what's essentially the same thing.
>
> It isn't the same thing.

Essentially the same != the same

Addition using integers is still called addition even if it isn't the same thing as mathematical arithmetic.

November 01, 2020
On Sunday, 1 November 2020 at 16:37:19 UTC, Andrei Alexandrescu wrote:
> On 11/1/20 5:15 AM, claptrap wrote:
>> On Saturday, 31 October 2020 at 23:09:31 UTC, Manu wrote:
>>> On Sat, Oct 31, 2020 at 12:05 PM Paul Backus via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>>> Is "Alias Sequence" present in spec language?
>>> This really demonstrates how much D needs first-class tuples; this area of
>>> the language is a shit-fight, and essentially just a weird abuse of
>>> template argument lists mixed with `alias` and some implementation defined
>>> behaviour, which happens to look and feel a lot like a tuple.
>> 
>> tuples already exists in other languages, in math / set theory, it's already a fairly well established idea and it seems a bit weird for D to invent its own name for what's essentially the same thing.
>
> It isn't the same thing.

Why isn't it the same thing? An AliasSeq and a tuple are both an ordered list of elements. That one holds values and the other holds aliases is down to the context in which either is used i think. So if you say we need to differentiate them, maybe thats a point, but then maybe it shouldn't need to be like that. Maybe they should be the same thing.


November 01, 2020
On Sunday, 1 November 2020 at 19:24:07 UTC, claptrap wrote:
> Why isn't it the same thing? An AliasSeq and a tuple are both an ordered list of elements. That one holds values and the

I don't know, but what it is, is described here:

https://dlang.org/articles/ctarguments.html