D needs a type expression syntax
Dukc
ajieskola at gmail.com
Thu May 11 13:51:28 UTC 2023
On Thursday, 11 May 2023 at 11:38:08 UTC, Timon Gehr wrote:
> On 08.05.23 13:21, Petar Kirov [ZombineDev] wrote:
>> On Sunday, 7 May 2023 at 07:35:22 UTC, Timon Gehr wrote:
>>> [..]
>>>
>>> Having `T[2]` be a tuple type `[T,T]` is one of those things
>>> that initially sound good enough on paper until you actually
>>> examine the existing array semantics that D already has and
>>> try to square them with tuple semantics. It does not work at
>>> all. D would need to break arrays. It's a pipe dream.
>>>
>>
>> Can you explain in more detail which parts of the language
>> make the unification impossible currently? Or to phrase the
>> question differently, in a hypothetical D3 language what
>> (breaking) changes we would need to do relative to D2 to make
>> this possible?
>
> I am not sure it is desirable if arrays are not all value types.
>
> [snip]
Good points. I'll add:
- `sizeof(T[0]) == 0`, but `sizeof(Tuple!()) == 1`. I'm not sure
why.
More information about the Digitalmars-d
mailing list