const challenge
Derek Parnell
derek at psych.ward
Sat Feb 2 15:16:32 PST 2008
On Sat, 2 Feb 2008 12:54:54 +0000, Janice Caron wrote:
> 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)
Ok, so maybe I'm /am/ going mad ... but this is what happens on my machine
...
c:\temp>type test.d
import std.stdio;
void main()
{
string s;
char[] t;
char[] u = "hello" ~ s ~ t;
writefln("%s", u);
}
c:\temp>dmd test
c:\dmd\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi;
c:\temp>test
hello
c:\temp>dmd
Digital Mars D Compiler v2.010
Copyright (c) 1999-2008 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/index.html
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list