Hmm - about manifest/enum

Walter Bright newshound1 at digitalmars.com
Tue Jan 1 22:31:15 PST 2008


Bill Baxter wrote:
> What was the fundamental problem with creating some syntax that would 
> let you peel the reference part off a class reference?

const(C)&[] a;

is a sortable array of constant C's. But what is:

const(int)&[] a;

Is it sortable or not? If it is sortable, then & means "tail const". If 
it is not sortable, then how, in generic code, do we specify a sortable 
array of type T?

const(T)&[] a; // is it sortable or not?

Now, if & is to mean "tail const", what do we do with:

struct S
{ int i;
   int* p;
   void foo() { *p = 3; }
}

const(S)& s;

Does that mean we can modify the members of S, but not what those 
members may point to? How do we specify that member function foo is 
"tail const" ?

And what do we do with:

struct S { C c; }
const(S)&[] a;

Here, we've wrapped a class with a struct. Is it possible to make S 
behave like its underlying C? If not, we don't have general purpose 
UDTs. We have a heaping pile of special cases.



More information about the Digitalmars-d mailing list