June 27, 2012 Re: Why type specialization is defined differently than is expression type specialization ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roman D. Boiko | On Wed, 27 Jun 2012 16:32:33 -0400, Roman D. Boiko <rb@d-coding.com> wrote:
> On Wednesday, 27 June 2012 at 20:27:39 UTC, Steven Schveighoffer wrote:
>> On Wed, 27 Jun 2012 16:16:53 -0400, Roman D. Boiko <rb@d-coding.com> wrote:
>>>> TypeSpecialization:
>>>>
>>>> Type struct union class interface enum function delegate super const immutable inout shared return
>>
>> This is only valid for is( Type == TypeSpecialization)
>
> No, unless the D specification is outdated.
>
> IsExpression:
> is ( Type )
> is ( Type : TypeSpecialization )
> is ( Type == TypeSpecialization )
> ...
It's poorly written, TypeSpecialization is restricted for the : case. Maybe it passes the parser, but fails on semantic.
"TypeSpecialization is only allowed to be a Type." -- context for is(Type : TypeSpecialization)
-Steve
|
June 27, 2012 Re: Why type specialization is defined differently than is expression type specialization ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Wednesday, 27 June 2012 at 20:35:47 UTC, Steven Schveighoffer wrote:
> On Wed, 27 Jun 2012 16:32:33 -0400, Roman D. Boiko <rb@d-coding.com> wrote:
>
> It's poorly written, TypeSpecialization is restricted for the : case. Maybe it passes the parser, but fails on semantic.
>
> "TypeSpecialization is only allowed to be a Type." -- context for is(Type : TypeSpecialization)
>
Yeah, I found that after your post. Probably it was easier to implement an IsExpression in a unified way and check semantics separately. Otherwise it would be that IsExpression have to contain different types of members, if Type (not TypeSpecialization) in the `:` case, and the latter in the `TypeSpecialization` case.
|
June 27, 2012 Re: Why type specialization is defined differently than is expression type specialization ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roman D. Boiko | On Wed, 27 Jun 2012 16:40:47 -0400, Roman D. Boiko <rb@d-coding.com> wrote:
> On Wednesday, 27 June 2012 at 20:35:47 UTC, Steven Schveighoffer wrote:
>> On Wed, 27 Jun 2012 16:32:33 -0400, Roman D. Boiko <rb@d-coding.com> wrote:
>>
>> It's poorly written, TypeSpecialization is restricted for the : case. Maybe it passes the parser, but fails on semantic.
>>
>> "TypeSpecialization is only allowed to be a Type." -- context for is(Type : TypeSpecialization)
>>
>
> Yeah, I found that after your post. Probably it was easier to implement an IsExpression in a unified way and check semantics separately. Otherwise it would be that IsExpression have to contain different types of members, if Type (not TypeSpecialization) in the `:` case, and the latter in the `TypeSpecialization` case.
Hm... come to think of it, shouldn't TypeSpecialization be Type instead?
Seems weird to say Type : TypeSpecialization, and then say "TypeSpecialization is only allowed to be Type". Why not Type : Type?
-Steve
|
June 27, 2012 Re: Why type specialization is defined differently than is expression type specialization ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Wednesday, 27 June 2012 at 20:42:39 UTC, Steven Schveighoffer wrote: > Hm... come to think of it, shouldn't TypeSpecialization be Type instead? > > Seems weird to say Type : TypeSpecialization, and then say "TypeSpecialization is only allowed to be Type". Why not Type : Type? That's what I was trying to explain. It is probably easier to implement an IsExpression this way, because it would always contain members of the same types. Also, I made a typo, should be: > and TypeSpecialization in the `==` case. |
June 27, 2012 Re: Why type specialization is defined differently than is expression type specialization ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Le 27/06/2012 22:35, Steven Schveighoffer a écrit :
> On Wed, 27 Jun 2012 16:32:33 -0400, Roman D. Boiko <rb@d-coding.com> wrote:
>
>> On Wednesday, 27 June 2012 at 20:27:39 UTC, Steven Schveighoffer wrote:
>>> On Wed, 27 Jun 2012 16:16:53 -0400, Roman D. Boiko <rb@d-coding.com>
>>> wrote:
>>>>> TypeSpecialization:
>>>>>
>>>>> Type struct union class interface enum function delegate super
>>>>> const immutable inout shared return
>>>
>>> This is only valid for is( Type == TypeSpecialization)
>>
>> No, unless the D specification is outdated.
>>
>> IsExpression:
>> is ( Type )
>> is ( Type : TypeSpecialization )
>> is ( Type == TypeSpecialization )
>> ...
>
> It's poorly written, TypeSpecialization is restricted for the : case.
> Maybe it passes the parser, but fails on semantic.
>
> "TypeSpecialization is only allowed to be a Type." -- context for
> is(Type : TypeSpecialization)
>
> -Steve
OK, I had misunderstood here too.
This whole is stuff is kind of messed up.
|
Copyright © 1999-2021 by the D Language Foundation