On Monday, 2 November 2020 at 03:49:41 UTC, Manu wrote:
> On Mon, Nov 2, 2020 at 8:15 AM Ola Fosheim Grøstad via
> Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>> Well, it is a good thing if they behave as immutable structs
>> as you then can get a more uniform language.
>
> I think it is conceptually improper for a tuple to have a
> memory layout; especially considering tuples can hold elements
> that are types or aliases in addition to typed values.
D should reduce the number of types you have to account for in
generic code.
I'm not sure what this means.
> It's also extremely complicated to know what the output of
> `...` applied to
> an array-like thing should be? Is it a tuple? If you apply
> `...` to an
> array or a range, and it becomes a tuple, that is probably
> going to reveal
> serious semantic problems.
It should not be a tuple, it should be an extension of a comma
list. Think splat operator.
My DIP is not like that.
The compiler only needs to know the length of the sequence in
order to expand.
> fun(constantRange); // <-- function receives range as argument
> fun(expr(constantRange)...); // <-- the function call fails
I dont understand this example.
The type is lost, so by applying a map expression to an array-like-thing, you can't use it in its original context anymore.
>
> Or this:
> immutable int[] allTheThings = [ ... ];
> alias Selection = AliasSeq!(5, 1, 15);
> alias res = allTheThings[Selection]...; // <-- we have an
> array, and a
> tuple both participating in the map; if `...` applied to
> array-like-things,
> then this extremely important pattern would be impossible
I suggested explicit indexing, so not a problem.
I don't understand this comment.