Hiding class pointers -- was it a good idea?

Walter Bright newshound1 at digitalmars.com
Thu Aug 16 11:36:53 PDT 2007


eao197 wrote:
> I'm totaly agree with you. This is why I'm interested in D, not in C++.
> But in the case with value type/reference type separation there are some 
> benefits and drawbacks in the current D version. So I think that 
> 'slicing' is not an important argument in defense of such separation.
> 
> Because value/reference separation it is a fundamental feature of D so 
> it is better to concentrate to minimization of value/reference/pointer 
> conceptions. For example, what's about removing 'reference' at all? Lets 
> D has only values and pointers:
> 
> int i; // value.
> int * pi; // pointer to value.
> struct S { ... }
> S s; // value.
> S * ps; // pointer to value.
> class C { ... }
> C c; // Error! Value type cannot be used as value.
> C * c; // OK. Pointer to reference type.
> 
> void f( int i, S s, S * s, C * c ) { ... }

But I think if one pulls on that string, one eventually winds up with 
how C++ does it, with all of the problems.



More information about the Digitalmars-d mailing list