IFTI needs to be updated if you accept tuples

Basile B. b2.temp at gmx.com
Tue May 28 01:43:02 UTC 2024


On Tuesday, 28 May 2024 at 01:16:55 UTC, Basile B. wrote:
> On Monday, 27 May 2024 at 18:17:28 UTC, Sergey wrote:
>> On Monday, 27 May 2024 at 17:17:41 UTC, Basile B. wrote:
>>> things like
>>>
>>> ```d
>>> void test(T,U,V)((T,U,V) tuv){}
>>> ```
>>>
>>> need to work with
>>>
>>> ```d
>>> test((0.1, 1, false)) //  T= double, U = int, V = bool
>>> ```
>>>
>>> just saying
>>
>> You need to add expand currently 
>> https://dlang.org/library/std/typecons/tuple.expand.html
>> Because D doesn’t have real tuples.
>>
>> But our hope with Timon
>
> implemented 
> [here](https://gitlab.com/styx-lang/styx/-/blob/master/src/styx/semantic/expressions.sx#L5594). IFTI might me a little different compared to IGA. In first palce I did not want to use the same name as IGA was a little under and also did other things ;)

example

```
struct S[T]
{
     @constructor function make(T t){}
}

function main(): s32
{
     var someEss = S.make(0);
     return 0;
}
```

that is just nice. in D that is impossible. You have to write

```
struct S(T)
{
     this(T t){}
}

auto makeAess(T)(T t)
{
     return S!(T)(t);
}

int main()
{
     auto someEss = makeAess(0);
     return 0;
}
```


More information about the Digitalmars-d mailing list