View mode: basic / threaded / horizontal-split · Log in · Help
June 25, 2012
Re: equality operators on types
On Sat, 16 Jun 2012 01:19:49 -0400, Bernard Helyer <b.helyer@gmail.com>  
wrote:

> On Friday, 15 June 2012 at 12:56:49 UTC, Timon Gehr wrote:
>> On 06/15/2012 02:19 PM, bearophile wrote:
>>> Timon Gehr:
>>>
>>>> Why not allow equality operators to operate on types?
>>>
>>> That's nice, of course. But is it possible?
>>>
>>
>> Yes, certainly.
>
> Not without losing the context insensitivity of the D grammar (because  
> now we can't say for certain what "T == J" is until we semantically  
> understand the program, but as it is now we understand it as comparing  
> two values). That's a big thing to throw away, and this doesn't justify  
> the change.

Doesn't it already have to parse this today?  I mean, is it the parser  
that decides T == J is invalid if T and J are types, or something later?

It doesn't seem to me to be an issue with context insensitivity, if you  
have no context, you *already* can't know whether "T == J" is valid or  
not.  By itself, T == J fits into D's grammar.

Bitch-slap me if I'm wrong, I'm certainly not an expert in this here :)

-Steve
June 25, 2012
Re: equality operators on types
On 06/25/2012 02:40 PM, Steven Schveighoffer wrote:
> On Sat, 16 Jun 2012 01:19:49 -0400, Bernard Helyer <b.helyer@gmail.com>
> wrote:
>
>> On Friday, 15 June 2012 at 12:56:49 UTC, Timon Gehr wrote:
>>> On 06/15/2012 02:19 PM, bearophile wrote:
>>>> Timon Gehr:
>>>>
>>>>> Why not allow equality operators to operate on types?
>>>>
>>>> That's nice, of course. But is it possible?
>>>>
>>>
>>> Yes, certainly.
>>
>> Not without losing the context insensitivity of the D grammar (because
>> now we can't say for certain what "T == J" is until we semantically
>> understand the program, but as it is now we understand it as comparing
>> two values). That's a big thing to throw away, and this doesn't
>> justify the change.
>
> Doesn't it already have to parse this today? I mean, is it the parser
> that decides T == J is invalid if T and J are types, or something later?
>
> It doesn't seem to me to be an issue with context insensitivity, if you
> have no context, you *already* can't know whether "T == J" is valid or
> not. By itself, T == J fits into D's grammar.
>
> Bitch-slap me if I'm wrong, I'm certainly not an expert in this here :)
>
> -Steve

You are right.
Next ›   Last »
1 2 3
Top | Discussion index | About this forum | D home