Discussion Thread: DIP 1041--Attributes for Higher-Order Functions--Community Review Round 1
Johannes Loher
johannes.loher at fg4f.de
Thu Apr 15 14:45:25 UTC 2021
On Thursday, 15 April 2021 at 13:33:37 UTC, deadalnix wrote:
> On Thursday, 15 April 2021 at 01:15:34 UTC, Paul Backus wrote:
>> On Wednesday, 14 April 2021 at 23:51:33 UTC, deadalnix wrote:
>>> On Wednesday, 14 April 2021 at 22:23:38 UTC, Timon Gehr wrote:
>>>> For example, above, the semantics of `T[]` and `T
>>>> delegate(S)` are not fully compositional, because they have
>>>> special cases for `T = void`.
>>>>
>>>
>>> How is void delegate(S) a spcial case?
>>>
>>> Great post, BTW.
>>
>> You can't use `void` as a type on its own, but you *can* use
>> it in certain specific contexts, like `void delegate(S)` and
>> `void[]`. Those specific contexts are special cases: they're
>> not derived from any general rule, but have to be spelled out
>> explicitly in the language spec. (For example,
>> https://dlang.org/spec/arrays.html#void_arrays)
>
> idk, it seems to be that not being able to declare a void
> variable is the special case. There are expression in D of type
> void, and they compose like the rest of it.
You are right, but that’s just another special case for `void`
(that should just be fixed imo, I think Dennis is working on a
DIP for that). `void` arrays are still a special case because
they are the super type of all arrays. This is completely
contrary to how array subtyping works for basically all other
types. But this is starting to get off topic.
More information about the Digitalmars-d
mailing list