const challenge

Janice Caron caron800 at googlemail.com
Sat Feb 2 04:54:54 PST 2008


On 2/2/08, Derek Parnell <derek at psych.ward> wrote:
> On Sat, 2 Feb 2008 11:42:57 +0000, Janice Caron wrote:
>
> > Still - nobody here was suggesting unique "on a whim". Rather, it was
> > to solve a class of problems, the most obvious of which is to allow
> > the following to compile:
> >
> >     string s;
> >     char[] t;
> >     char[] u = "hello" ~ s ~ t;
>
> But that already compiles and runs okay.

No it doesn't. The error message is:

Error: non-constant expression cast(const(char)[])("hello" ~ s) ~
cast(const(char)[])t;

(Perhaps you were thinking of D1.x. This is a D2.x conversation)



More information about the Digitalmars-d mailing list