Re: CTFE toUpper/toLower

2012-08-29 Thread Jacob Carlborg
On 2012-08-30 08:28, Jacob Carlborg wrote: It works for me. DMD 2.060 Mac OS X. Oh, it does not. If I replace: enum string[] fields = [EnumMembers!E].to!(string[]); With: enum string[] fields = ["one", "two"]; It works. -- /Jacob Carlborg

Re: CTFE toUpper/toLower

2012-08-29 Thread Jacob Carlborg
On 2012-08-30 02:13, cal wrote: Given this code for CTFE on a string array: enum E {one, two} enum string[] fields = [EnumMembers!E].to!(string[]); string print(string[] fields) { string s; foreach(string field; fields) { s ~= field.toUpper ~ ", "; } return s;

Re: CTFE toUpper/toLower

2012-08-29 Thread cal
On Thursday, 30 August 2012 at 05:26:52 UTC, Philippe Sigaud wrote: And with no UFCS ? Did you try s ~= toUpper(field) ~ ", "; Yeah with or without UFCS, the second one fails.

Re: rdmd & exception def & multiple files

2012-08-29 Thread Charles Hixson
On 08/29/2012 06:46 PM, Andrei Alexandrescu wrote: On 8/29/12 4:52 PM, Charles Hixson wrote: On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote: On 8/29/12 3:47 PM, Charles Hixson wrote: Where should I look to better understand rdmd? I expected to need to list all the local files that were need

Re: CTFE toUpper/toLower

2012-08-29 Thread Philippe Sigaud
On Thu, Aug 30, 2012 at 2:13 AM, cal wrote: > Given this code for CTFE on a string array: > > enum E {one, two} > enum string[] fields = [EnumMembers!E].to!(string[]); > > string print(string[] fields) > { > string s; > foreach(string field; fields) > { > s ~= field.toUpper ~ "

Re: rdmd & exception def & multiple files

2012-08-29 Thread Philippe Sigaud
On Thu, Aug 30, 2012 at 1:09 AM, Charles Hixson wrote: > Well, it worked until I started "depending on it". Then it stopped. > So I guess that, at least for exceptions, they need to be defined within the > same file that they are used for rdmd to be happy with them, though clearly > that's not tr

Re: rdmd & exception def & multiple files

2012-08-29 Thread Andrei Alexandrescu
On 8/29/12 4:52 PM, Charles Hixson wrote: On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote: On 8/29/12 3:47 PM, Charles Hixson wrote: Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach. http://

CTFE toUpper/toLower

2012-08-29 Thread cal
Given this code for CTFE on a string array: enum E {one, two} enum string[] fields = [EnumMembers!E].to!(string[]); string print(string[] fields) { string s; foreach(string field; fields) { s ~= field.toUpper ~ ", "; } return s; } pragma(msg, print(["one", "two"]));

Re: rdmd & exception def & multiple files

2012-08-29 Thread Charles Hixson
On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote: On 8/29/12 3:47 PM, Charles Hixson wrote: Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach. http://dlang.org/rdmd.html To my surprise, it's n

Re: rdmd & exception def & multiple files

2012-08-29 Thread Charles Hixson
On 08/29/2012 03:47 PM, Charles Hixson wrote: On 08/29/2012 01:36 PM, Dmitry Olshansky wrote: On 30-Aug-12 00:14, Charles Hixson wrote: Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null

Re: rdmd & exception def & multiple files

2012-08-29 Thread Andrei Alexandrescu
On 8/29/12 3:47 PM, Charles Hixson wrote: Where should I look to better understand rdmd? I expected to need to list all the local files that were needed, but clearly that's the wrong approach. http://dlang.org/rdmd.html To my surprise, it's not in the top Google search results. However, Dmitr

Re: rdmd & exception def & multiple files

2012-08-29 Thread Charles Hixson
On 08/29/2012 01:36 PM, Dmitry Olshansky wrote: On 30-Aug-12 00:14, Charles Hixson wrote: Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line,

Re: rdmd & exception def & multiple files

2012-08-29 Thread Dmitry Olshansky
On 30-Aug-12 00:14, Charles Hixson wrote: Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line, next ); } } In the same

rdmd & exception def & multiple files

2012-08-29 Thread Charles Hixson
Is the following expected? When I put the exception: class LogicError : Exception { this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) { super( "Internal logic error", file, line, next ); } } In the same file as the rest of the program, rdmd --main

Re: abnormal program termination

2012-08-29 Thread Ellery Newcomer
On 08/28/2012 01:03 PM, Ellery Newcomer wrote: On 08/28/2012 09:55 AM, Regan Heath wrote: > I searched the DMD sources, just in case the message "abnormal > program termination" was DMD specific, and I found nothing. Then I > searched all files and the string appears in the dmd.exe binary, >

Re: Call a function on an entire slice

2012-08-29 Thread Timon Gehr
On 08/29/2012 03:38 PM, monarch_dodra wrote: D provides ways to operate on an entire (sub) slice: int[] a = ... ; a[] *= 5; //Multiply everything by 5. a[0 .. 2] = 3; //Set indexes 0 to 1 to the value 3. I was wondering if there was any way to do this for a specified function? struct S {

Re: std.regex - ctRegex

2012-08-29 Thread Juanjo �lvarez
Yes, I don't now about 2.059 (I've just recently make my comeback to D) but very simple ctRegex-es take pretty quickly all the memory (6GB) of my laptop. "David" wrote in message news:k1aqf9$q76$1...@digitalmars.com... > Am 25.08.2012 17:17, schrieb nazriel: >> First of all: >> *First read whol

Call a function on an entire slice

2012-08-29 Thread monarch_dodra
D provides ways to operate on an entire (sub) slice: int[] a = ... ; a[] *= 5; //Multiply everything by 5. a[0 .. 2] = 3; //Set indexes 0 to 1 to the value 3. I was wondering if there was any way to do this for a specified function? struct S { void foo() { writeln("foo");

Re: abnormal program termination

2012-08-29 Thread Regan Heath
On Tue, 28 Aug 2012 21:03:47 +0100, Ellery Newcomer wrote: If you like, you could try building the unreduced case download pyd https://bitbucket.org/ariovistus/pyd from top dir, run (python setup.py install) go to examples/wrap, run (python setup.py build) Ok. I downloaded and installed p

Re: abnormal program termination

2012-08-29 Thread Regan Heath
On Wed, 29 Aug 2012 09:47:57 +0100, Regan Heath wrote: On Tue, 28 Aug 2012 21:03:47 +0100, Ellery Newcomer wrote: If you like, you could try building the unreduced case download pyd https://bitbucket.org/ariovistus/pyd from top dir, run (python setup.py install) go to examples/wrap, run