Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
May 25, 2020 Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
This seems to be an overlook: https://issues.dlang.org/show_bug.cgi?id=20863 Are there any non-bug cases showing different treatment of type parameters vs. alias parameters? I mean: template xyz(T) { ... } vs. template xyz(alias T) { ... } The second should "catch" everything the first does, and more. |
May 25, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Monday, 25 May 2020 at 20:58:56 UTC, Andrei Alexandrescu wrote:
> This seems to be an overlook:
>
> https://issues.dlang.org/show_bug.cgi?id=20863
>
> Are there any non-bug cases showing different treatment of type parameters vs. alias parameters? I mean:
>
> template xyz(T) { ... }
>
> vs.
>
> template xyz(alias T) { ... }
>
> The second should "catch" everything the first does, and more.
It used to be the case that alias parameters could not bind basic types.
Because they are not symbols.
However I gather that this issue has been "worked around"
Therefore, an alias would bind to almost anything.
including any type.
|
May 26, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Monday, 25 May 2020 at 21:13:10 UTC, Stefan Koch wrote:
> On Monday, 25 May 2020 at 20:58:56 UTC, Andrei Alexandrescu wrote:
>> This seems to be an overlook:
>>
>> https://issues.dlang.org/show_bug.cgi?id=20863
>>
>> Are there any non-bug cases showing different treatment of type parameters vs. alias parameters? I mean:
>>
>> template xyz(T) { ... }
>>
>> vs.
>>
>> template xyz(alias T) { ... }
>>
>> The second should "catch" everything the first does, and more.
>
> It used to be the case that alias parameters could not bind basic types.
> Because they are not symbols.
>
> However I gather that this issue has been "worked around"
> Therefore, an alias would bind to almost anything.
> including any type.
Why can't basic types just be made symbols? They are symbols in more consistent languages (such as Haskell), where they are implicitly declared in a built-in namespace.
|
May 26, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | On Tuesday, 26 May 2020 at 11:33:04 UTC, Max Samukha wrote:
> On Monday, 25 May 2020 at 21:13:10 UTC, Stefan Koch wrote:
>> On Monday, 25 May 2020 at 20:58:56 UTC, Andrei Alexandrescu wrote:
>>> This seems to be an overlook:
>>>
>>> https://issues.dlang.org/show_bug.cgi?id=20863
>>>
>>> Are there any non-bug cases showing different treatment of type parameters vs. alias parameters? I mean:
>>>
>>> template xyz(T) { ... }
>>>
>>> vs.
>>>
>>> template xyz(alias T) { ... }
>>>
>>> The second should "catch" everything the first does, and more.
>>
>> It used to be the case that alias parameters could not bind basic types.
>> Because they are not symbols.
>>
>> However I gather that this issue has been "worked around"
>> Therefore, an alias would bind to almost anything.
>> including any type.
>
> Why can't basic types just be made symbols? They are symbols in more consistent languages (such as Haskell), where they are implicitly declared in a built-in namespace.
There is no fundamental reason (as far as I can see at least) why they couldn't be.
|
May 26, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | On Tuesday, 26 May 2020 at 11:33:04 UTC, Max Samukha wrote:
> On Monday, 25 May 2020 at 21:13:10 UTC, Stefan Koch wrote:
>> On Monday, 25 May 2020 at 20:58:56 UTC, Andrei Alexandrescu wrote:
>>> This seems to be an overlook:
>>>
>>> https://issues.dlang.org/show_bug.cgi?id=20863
>>>
>>> Are there any non-bug cases showing different treatment of type parameters vs. alias parameters? I mean:
>>>
>>> template xyz(T) { ... }
>>>
>>> vs.
>>>
>>> template xyz(alias T) { ... }
>>>
>>> The second should "catch" everything the first does, and more.
>>
>> It used to be the case that alias parameters could not bind basic types.
>> Because they are not symbols.
>>
>> However I gather that this issue has been "worked around"
>> Therefore, an alias would bind to almost anything.
>> including any type.
>
> Why can't basic types just be made symbols? They are symbols in more consistent languages (such as Haskell), where they are implicitly declared in a built-in namespace.
It's a moot point since alias template parameters now accept built in types.
|
May 26, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On Tuesday, 26 May 2020 at 16:04:17 UTC, Meta wrote:
>
> It's a moot point since alias template parameters now accept built in types.
Yes, with a ton of hacks in the implementation, I presume.
|
May 26, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samukha | On Tuesday, 26 May 2020 at 16:16:26 UTC, Max Samukha wrote:
> On Tuesday, 26 May 2020 at 16:04:17 UTC, Meta wrote:
>
>>
>> It's a moot point since alias template parameters now accept built in types.
>
> Yes, with a ton of hacks in the implementation, I presume.
No it was a one line change.
DMD is much better and handling wired ASTs than you give it credit for.
The overload resolution was changed to accept types on the matching level convert
That's it.
|
May 27, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Tuesday, 26 May 2020 at 18:49:05 UTC, Stefan Koch wrote:
> No it was a one line change.
> DMD is much better and handling wired ASTs than you give it credit for.
> The overload resolution was changed to accept types on the matching level convert
> That's it.
Then I need to shut up and look at the code.
|
June 04, 2020 Re: Is binding to alias a definite superset of binding to a type parameter? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Monday, 25 May 2020 at 20:58:56 UTC, Andrei Alexandrescu wrote: > This seems to be an overlook: > > https://issues.dlang.org/show_bug.cgi?id=20863 I made a pull to remove unnecessary overloads in std.meta, and ran into this bug. Maybe you found it doing the same? https://github.com/dlang/phobos/pull/7513 |
Copyright © 1999-2021 by the D Language Foundation