October 11, 2015
On Sunday, 11 October 2015 at 09:43:04 UTC, Idan Arye wrote:
> On Friday, 9 October 2015 at 19:48:39 UTC, Dmitry Olshansky wrote:
>
> This is the innovation in D(regarding this issue) - that on struct types, the same operator is used for BOTH the value type and the pointer to it.

At the risk of sounding like a broken record the Delphi variant of Object Pascal started doing that some time around Delphi 4 or Delphi 5 IIRC. (So mid to late 90s).

IE. You accessed members with the dot operator whether it was an object (like D Delphi's objects are heap based / reference semantics), a struct, or a pointer to a struct.


October 11, 2015
On Sunday, 11 October 2015 at 13:05:41 UTC, Warwick wrote:
> On Sunday, 11 October 2015 at 09:43:04 UTC, Idan Arye wrote:
>> On Friday, 9 October 2015 at 19:48:39 UTC, Dmitry Olshansky wrote:
>>
>> This is the innovation in D(regarding this issue) - that on struct types, the same operator is used for BOTH the value type and the pointer to it.
>
> At the risk of sounding like a broken record the Delphi variant of Object Pascal started doing that some time around Delphi 4 or Delphi 5 IIRC. (So mid to late 90s).
>
> IE. You accessed members with the dot operator whether it was an object (like D Delphi's objects are heap based / reference semantics), a struct, or a pointer to a struct.

You should have elaborated then. The other guys talked about the invention of reference types, so I assumed you did as well.
October 11, 2015
On Sunday, 11 October 2015 at 09:43:04 UTC, Idan Arye wrote:
> This is the innovation in D(regarding this issue) - that on struct types, the same operator is used for BOTH the value type and the pointer to it.

BETA is the successor to Simula and it does not distinguish between value or reference and only use dot reference. What they do instead of having a dereference operator is to have a "reference operator" and also a "pattern operator" for type variables. So it works something like this:

Call a and send the output as the input to b and then store the result:

    (1,(2,3)) -> a -> b -> (c,(d,e))

Assign reference a to b (instanced class/function)

    a[] -> b[]

Replace class-type variable a with class-type b (not instanced, which is equivalent to a class-type/function pointer)

     a## -> b##

It makes a lot of sense for an OO language since we usually use the referenced content more often than we want to change the pointer.

October 11, 2015
On Sunday, 11 October 2015 at 13:50:18 UTC, Idan Arye wrote:
> On Sunday, 11 October 2015 at 13:05:41 UTC, Warwick wrote:
>> On Sunday, 11 October 2015 at 09:43:04 UTC, Idan Arye wrote:
>>> On Friday, 9 October 2015 at 19:48:39 UTC, Dmitry Olshansky wrote:
>> At the risk of sounding like a broken record the Delphi variant of Object Pascal started doing that some time around Delphi 4 or Delphi 5 IIRC. (So mid to late 90s).
>>
>> IE. You accessed members with the dot operator whether it was an object (like D Delphi's objects are heap based / reference semantics), a struct, or a pointer to a struct.
>
> You should have elaborated then. The other guys talked about the invention of reference types, so I assumed you did as well.

Sorry I've been on pills to prevent premature elaboration. :-)
October 11, 2015
On Friday, 9 October 2015 at 03:41:42 UTC, Walter Bright wrote:
> These, of course, are C++ operators that are replace with the . operator in D. But when I translate C++ code to D, sometimes these operators get left behind, and sometimes I simply reflexively type them into D code.
>
> The error message coming out of dmd could be better. I suggest recognizing -> and :: in the lexer, and saying something like:
>
>    "The '->' operator is not in D, did you mean '.'?"
>
> Anyone want to do a PR for this? (Should be pretty straightforward.)

https://issues.dlang.org/show_bug.cgi?id=15186
https://github.com/D-Programming-Language/dmd/pull/5190
1 2 3
Next ›   Last »