What if D would require * for reference types?

Bill Baxter wbaxter at gmail.com
Mon Jan 18 16:40:07 PST 2010


On Mon, Jan 18, 2010 at 4:25 PM, Walter Bright
<newshound1 at digitalmars.com> wrote:
> Denis Koroskin wrote:
>>
>> What do you think? I understand it is unlikely to make its way into D2
>> (D3?), but is it sound? Do you think it's useless, or do you think that
>> additional consistency (and functionality) is worthwhile?
>
> What this means is that classes will be usable as a value type, like in C++.
> In C++, this causes all sorts of trouble, as a value type and a reference
> type are fundamentally different things with different uses.

No problem there, just don't allow it:

       Foo f;  // error - classes cannot be used as value types

I think it's mentioned somewhere in that thread.  There are probably
some good reasons to object to the proposal, but I don't think that's
one of them.

--bb



More information about the Digitalmars-d mailing list