April 02
On Tuesday, 2 April 2019 at 00:13:13 UTC, Andrei Alexandrescu wrote:
> On 4/1/19 7:43 PM, Rubn wrote:
>> On Monday, 1 April 2019 at 20:37:03 UTC, Walter Bright wrote:
>>> [...]
>> 
>> You can try it yourself:
>> 
>> void foo(int* const p) {}
>> void foo(int p[]) {}
>> -----------------------------------------------
>> test.cpp:3:6: error: redefinition of 'foo'
>> void foo(int p[]) {}
>>       ^
>> test.cpp:2:6: note: previous definition is here
>> void foo(int* const p) {}
>>       ^
>> 1 error generated.
>
> The fact that we have somebody teaching Walter Bright the C language to is supremely ironic in wake of the recent discussions.

+1000! But at least it's funny!

:-P
April 02
On 4/2/19 4:11 AM, Walter Bright wrote:
> On 4/1/2019 5:55 PM, Atila Neves wrote:
>> Factually incorrect.
> 
> I suspect Rubn has confused the syntactical conflation of arrays with pointers in C, and the implicit coercion of arrays to pointers, as them being the same. They simply aren't the same, as they are semantically separated by one level of indirection.

You forgot to mention that top-level "const" is ignored in function parameters (for the signature and mangling but not the implementation). Now the fact that "42" is just ignored in the declaration below is indistinguishable from conspiracy:

void fun(int a[42]);
April 02
On 4/2/2019 4:05 AM, Andrei Alexandrescu wrote:
> You forgot to mention that top-level "const" is ignored in function parameters (for the signature and mangling but not the implementation).

Curiously, it is present in the name mangling for dmc++ and dmd (for extern(D)), but it should be fixed for dmd.

https://issues.dlang.org/show_bug.cgi?id=19785


> Now the fact that "42" is just ignored in the declaration below is indistinguishable from conspiracy:
> 
> void fun(int a[42]);

Ironically, it is not ignored in the C++ mangling if it's a ref to int[42].

April 03
On Tuesday, 2 April 2019 at 07:58:21 UTC, Walter Bright wrote:
> On 4/1/2019 5:20 PM, Rubn wrote:
>> Let's put it this way, is const a type?
>
> No. It's a "type qualifier".

Enough so that it is called a storage class in the DMD source code.
April 03
On Tuesday, 2 April 2019 at 08:05:25 UTC, Walter Bright wrote:
> But they [arrays of reference] are not allowed in C++, because ref is a storage class pretending to be a type.

And we've come back fully circle. This is not the reason at all why an array of references is not allowed. You can't have pointers to references, and without pointers you can't have a full array implementation. How much sense would it make if you could only pass an array by reference? Not very much.


April 03
On Tuesday, 2 April 2019 at 08:11:31 UTC, Walter Bright wrote:
> On 4/1/2019 5:55 PM, Atila Neves wrote:
>> Factually incorrect.
>
> I suspect Rubn has confused the syntactical conflation of arrays with pointers in C, and the implicit coercion of arrays to pointers, as them being the same. They simply aren't the same, as they are semantically separated by one level of indirection.

I have not said they are the same, do regex search of "the same", and you will see only you and someone else have said this formation of words.

> I wrote an article about it calling this "C's Biggest Mistake", as this has led to decades of crashes and malware infestations:
>
> https://www.digitalmars.com/articles/b44.html

Yes arrays only being able to be represented as pointers is indeed a downfall of C/C++.
April 03
On Tuesday, 2 April 2019 at 20:43:14 UTC, Walter Bright wrote:
> On 4/2/2019 4:05 AM, Andrei Alexandrescu wrote:
>> You forgot to mention that top-level "const" is ignored in function parameters (for the signature and mangling but not the implementation).
>
> Curiously, it is present in the name mangling for dmc++ and dmd (for extern(D)), but it should be fixed for dmd.
>
> https://issues.dlang.org/show_bug.cgi?id=19785
>
>
>> Now the fact that "42" is just ignored in the declaration below is indistinguishable from conspiracy:
>> 
>> void fun(int a[42]);
>
> Ironically, it is not ignored in the C++ mangling if it's a ref to int[42].

Not ironically, because you can't have a reference to a pointer :). It makes sense if you understand that:

   void foo( int a[] );

Is not a parameter to an array. After your whole spiel about ferraris, engines, and how their users won't see the internal workings of the engine. I'd have hoped better from you than you pointing at the top level fluffy user-friendly error message and saying LOOK LOOK it says array so it must be an array!
April 03
On Wednesday, 3 April 2019 at 20:10:08 UTC, Rubn wrote:
> On Tuesday, 2 April 2019 at 20:43:14 UTC, Walter Bright wrote:
>> On 4/2/2019 4:05 AM, Andrei Alexandrescu wrote:
>>> You forgot to mention that top-level "const" is ignored in function parameters (for the signature and mangling but not the implementation).
>>
>> Curiously, it is present in the name mangling for dmc++ and dmd (for extern(D)), but it should be fixed for dmd.
>>
>> https://issues.dlang.org/show_bug.cgi?id=19785
>>
>>
>>> Now the fact that "42" is just ignored in the declaration below is indistinguishable from conspiracy:
>>> 
>>> void fun(int a[42]);
>>
>> Ironically, it is not ignored in the C++ mangling if it's a ref to int[42].
>
> Not ironically, because you can't have a reference to a pointer :). It makes sense if you understand that:
>
>    void foo( int a[] );
>
> Is not a parameter to an array. After your whole spiel about ferraris, engines, and how their users won't see the internal workings of the engine. I'd have hoped better from you than you pointing at the top level fluffy user-friendly error message and saying LOOK LOOK it says array so it must be an array!

A pointer to a reference*.
April 03
On Wednesday, 3 April 2019 at 20:11:02 UTC, Rubn wrote:
> On Wednesday, 3 April 2019 at 20:10:08 UTC, Rubn wrote:
>> On Tuesday, 2 April 2019 at 20:43:14 UTC, Walter Bright wrote:
>>> On 4/2/2019 4:05 AM, Andrei Alexandrescu wrote:
>>>> You forgot to mention that top-level "const" is ignored in function parameters (for the signature and mangling but not the implementation).
>>>
>>> Curiously, it is present in the name mangling for dmc++ and dmd (for extern(D)), but it should be fixed for dmd.
>>>
>>> https://issues.dlang.org/show_bug.cgi?id=19785
>>>
>>>
>>>> Now the fact that "42" is just ignored in the declaration below is indistinguishable from conspiracy:
>>>> 
>>>> void fun(int a[42]);
>>>
>>> Ironically, it is not ignored in the C++ mangling if it's a ref to int[42].
>>
>> Not ironically, because you can't have a reference to a pointer :). It makes sense if you understand that:
>>
>>    void foo( int a[] );
>>
>> Is not a parameter to an array. After your whole spiel about ferraris, engines, and how their users won't see the internal workings of the engine. I'd have hoped better from you than you pointing at the top level fluffy user-friendly error message and saying LOOK LOOK it says array so it must be an array!
>
> A pointer to a reference*.

The Dunning-Kruger is strong with this one.

Arrogance completes ignorance.
April 03
On 03.04.19 21:56, Rubn wrote:
> On Tuesday, 2 April 2019 at 07:58:21 UTC, Walter Bright wrote:
>> On 4/1/2019 5:20 PM, Rubn wrote:
>>> Let's put it this way, is const a type?
>>
>> No. It's a "type qualifier".
> 
> Enough so that it is called a storage class>

Syntactically, it is both. However, annotating a variable with `const` will apply the type qualifier to its type without affecting how it is stored.

> in the DMD source code.

Check out mtype.d.
1 2 3 4 5 6 7