Revised RFC on range design for D2

Steven Schveighoffer schveiguy at yahoo.com
Mon Sep 29 14:10:31 PDT 2008


"Andrei Alexandrescu" wrote
> Steven Schveighoffer wrote:
>> "Steven Schveighoffer" wrote
>>> "Andrei Alexandrescu" wrote
>>>>> Not really.  A function symbol by itself is the address of the 
>>>>> function. A pointer symbol by itself is the address of the data it 
>>>>> points to. It's the same.  I don't think you understood the detail 
>>>>> that I stated, 'get address it's pointing to', not 'get address of the 
>>>>> pointer'.
>>>> I understood very well. Your point is off by a mile, and getting only 
>>>> farther. Please understand how you are making an elementary mistake.
>>>>
>>>> Consider:
>>>>
>>>> int x;
>>>>
>>>> Then if I only use "x", I am getting x's value (an lvalue in fact), not 
>>>> its address. Now consider:
>>>>
>>>> int * x;
>>>>
>>>> Then if I only use "x", I am getting x's value, which is the address of 
>>>> an int.
>>>>
>>>> In neither case is it possible for x and &x to mean the same thing. For 
>>>> functions some really weird stuff happens:
>>>>
>>>> // this is C
>>>> #include <assert.h>
>>>> void foo() {}
>>> How does this make any difference to whether you can call a function 
>>> without parentheses or not?  You are arguing that for a function defined 
>>> as foo(), foo; should mean call function foo, and I'm arguing that it 
>>> should be a syntax error.  Neither of us want the C behavior of 
>>> evaluating to the function address.
>>>
>>> I think &foo should be the proper method of taking the address of a 
>>> function, as it is in D.
>>
>> This is what happens when you can't explain yourself correctly.  Stop 
>> typing your vehement response about how I am an idiot right now :)  I 
>> realize my mistake in the statements above.
>>
>> I think the problem you cited with how foo is equivalent to &foo in C is 
>> bad.  I think we are getting sidetracked here, though.  The point I 
>> really want to state is that foo; shouldn't mean calling a function named 
>> foo.
>
> "State" is very accurate, because aside from stating the point you bring 
> nothing to support it.

Again with the 'nothing to support it'.  If you're not going to listen to my 
arguments, or even acknowledge that I made them, then there really is no 
point to this discussion.

>> I don't think it should mean the address of the function, although it 
>> seems consistent with C pointers (IMO, it seems like &foo shouldn't even 
>> compile in C if foo means 'address of foo' already).  &foo sounds correct 
>> to me, "address of foo."
>
> No. It does NOT seem and is NOT even remotely consistent with C pointers 
> because x is not the same thing as &x for all symbols in C except 
> functions. Please work through this with books and test programs and all, 
> until you fully understand it. It is important.

You are completely misunderstanding the scope of what I'm saying.  I'll just 
leave it at that.

>> Bottom line, I'm not defending the way C takes addresses of functions, 
>> but I think the requirement C has to use parentheses to call functions 
>> helps to clarify the intentions of the function author, and makes the 
>> code clearer.
>
> I agree, and I'd agree even more if you replaced "think" with "believe".


Think and believe to me both mean 'This is true in my mind'.  If you find 
one to be more appealing, so be it.

> I hope you also agree you have brought nothing of significance to support 
> your thought/belief, while you have received plenty against.

Again, you are either not paying enough attention, or you refuse to accept 
my arguments as valid arguments.  I'll stop bashing my head against this 
brick wall of your inability to comprehend or refusal to accept my 
arguments, and just let this conversation die.

> I also agree that Sergey, Bill, and others did bring up good points in 
> support for the required trailing "()". It would be more fertile to 
> continue discussing those.

If the end result is that it gets fixed, I'm all for it.

-Steve 




More information about the Digitalmars-d-announce mailing list