Best way to make Until! into string

2010-06-22 Thread Jonathan M Davis
Okay. If you call until like so str.until('\') you get a Until!(pred,string,char). I want to turn that into a string. array() doesn't seem to do the trick right now. It used to work, but now it gives me main.d(47): Error: template std.array.array(Range) if (isForwardRange! (Range)) does not

Re: Best way to make Until! into string

2010-06-22 Thread Philippe Sigaud
On Tue, Jun 22, 2010 at 08:38, Jonathan M Davis jmdavisp...@gmail.comwrote: Jonathan M Davis wrote: Okay. If you call until like so str.until('\') you get a Until!(pred,string,char). I want to turn that into a string. array() doesn't seem to do the trick right now. It used to work,

Re: Forking problems on OS X 2.047

2010-06-22 Thread Jacob Carlborg
On 2010-06-21 23:32, Byron Heads wrote: When I use fork I am getting a core.thread.ThreadException: Unable to load thread state exception. This is dmd 2.047 on OS X I am trying to convert a small C application. module fork; import core.sys.posix.unistd, std.stdio; void main() {

Re: dsss build, tango, GC ?

2010-06-22 Thread Fred Burton
when I run without valgrind of course, it runs faster so I don't need 4 minutes ... in less than 1 minute, it went from ~ 64 Mbytes to ~ 400 Mbytes --- trying with GC.collect() and GC.minimize() in main loop ... : Same result. hmm..

Re: Best way to make Until! into string

2010-06-22 Thread Jonathan M Davis
Philippe Sigaud wrote: I got this error also while installing 2.047. I think the new definition of a forward range asks for a .save() member. And I guess some ranges where not converted. std.range.repeat is one, like cycle. It seems like Until is another. Maybe for repeat/cycle that was a

Re: Best way to make Until! into string

2010-06-22 Thread div0
On 22/06/2010 07:29, Jonathan M Davis wrote: Okay. If you call until like so str.until('\') you get a Until!(pred,string,char). I want to turn that into a string. array() doesn't seem to do the trick right now. It used to work, but now it gives me main.d(47): Error: template

Re: Best way to make Until! into string

2010-06-22 Thread Jonathan M Davis
div0 wrote: On 22/06/2010 07:29, Jonathan M Davis wrote: Okay. If you call until like so str.until('\') you get a Until!(pred,string,char). I want to turn that into a string. array() doesn't seem to do the trick right now. It used to work, but now it gives me main.d(47): Error: template

Re: Best way to make Until! into string

2010-06-22 Thread div0
On 22/06/2010 19:26, Jonathan M Davis wrote: div0 wrote: On 22/06/2010 07:29, Jonathan M Davis wrote: Okay. If you call until like so str.until('\') you get a Until!(pred,string,char). I want to turn that into a string. array() doesn't seem to do the trick right now. It used to work, but

Why assert is in the language?

2010-06-22 Thread Tomek Sowiński
Yes, why? It could be implemented in object.d in a similar fashion as std.contracts.enforce. Does it do anything special that a library function couldn't? Tomek

Re: Why assert is in the language?

2010-06-22 Thread Steven Schveighoffer
On Tue, 22 Jun 2010 17:07:02 -0400, Tomek Sowiński j...@ask.me wrote: Yes, why? It could be implemented in object.d in a similar fashion as std.contracts.enforce. Does it do anything special that a library function couldn't? all calls to assert are removed by the compiler in release mode.

Re: Cannot initialize associative array.

2010-06-22 Thread dcoder
Sorry, I forgot to put some compiler output: For the declaration: uint[string] mywords = [ Hello : 1, World : 1, Cat : 1, Dog : 1 ]; I get: $ dmd test_01.d test_01.d(3): Error: non-constant expression [Hello:1u,World:1u,Cat:1u,Dog:1u]

Re: Why assert is in the language?

2010-06-22 Thread Michal Minich
On Tue, 22 Jun 2010 17:30:23 -0400, Steven Schveighoffer wrote: On Tue, 22 Jun 2010 17:07:02 -0400, Tomek Sowiński j...@ask.me wrote: Yes, why? It could be implemented in object.d in a similar fashion as std.contracts.enforce. Does it do anything special that a library function couldn't?

Re: Best way to make Until! into string

2010-06-22 Thread Jonathan M Davis
div0 wrote: [... snip of UTF-8 stuff ...] The UTF char stuff is all painfully complicated, and I _think_ that I more or less understand it, but I suspect that I don't understand it all that well. It would be nice if the there were a page in the docs somewhere that really explained it well.

Re: Cannot initialize associative array.

2010-06-22 Thread bearophile
Bernard Helyer: AAs can't be assigned to at compile time (:[). You can define enum ones, this works: import std.stdio; enum int[string] aa = [foo: 10]; void main() { writeln(cast(bool)(foo in aa)); writeln(aa[foo]); writeln(cast(bool)(hello in aa)); } But this code: import

Program option command line

2010-06-22 Thread bioinfornatics
hello, I develop in many language such C/C++ Java etc.. and i want try with D in c++ for example i use boost::program_option for parse command line. I search the same thing for D language. thanks

Re: Program option command line

2010-06-22 Thread Robert Clipsham
On 22/06/10 23:15, bioinfornatics wrote: hello, I develop in many language such C/C++ Java etc.. and i want try with D in c++ for example i use boost::program_option for parse command line. I search the same thing for D language. thanks If you're using D1/tango you can use

Re: Cannot initialize associative array.

2010-06-22 Thread Ali Çehreli
dcoder wrote: So, I moved the initialization to inside the main function, and now it works. Great. I think we need to put this question in the FAQ. For future reference, if it really needs to be global: uint[string] mywords; static this() { mywords = [ Hello : 1, World : 1, Cat : 1,

Re: Program option command line

2010-06-22 Thread bioinfornatics
great :-) sorry for this sutpid question i want try one project with D and i think is hard to find the good information for D programming (yea i need buy a book too) big thanks

Re: Why assert is in the language?

2010-06-22 Thread Ali Çehreli
Jonathan M Davis wrote: Steven Schveighoffer wrote: all calls to assert are removed by the compiler in release mode. I don't think there's a way to implement that via a library (it would be nice though!) Also IIRC, the compiler uses assert(0) to ensure that functions blow up at

Re: Forking problems on OS X 2.047

2010-06-22 Thread Masahiro Nakagawa
On Tue, 22 Jun 2010 06:32:21 +0900, Byron Heads wyverex.cyp...@gmail.com wrote: When I use fork I am getting a core.thread.ThreadException: Unable to load thread state exception. This is dmd 2.047 on OS X I am trying to convert a small C application. module fork; import

Re: Why assert is in the language?

2010-06-22 Thread Ellery Newcomer
On 06/22/2010 05:36 PM, Ali Çehreli wrote: Jonathan M Davis wrote: Steven Schveighoffer wrote: all calls to assert are removed by the compiler in release mode. I don't think there's a way to implement that via a library (it would be nice though!) Also IIRC, the compiler uses

Re: Why assert is in the language?

2010-06-22 Thread dennis luehring
Am 22.06.2010 23:07, schrieb Tomek Sowiñski: Yes, why? It could be implemented in object.d in a similar fashion as std.contracts.enforce. Does it do anything special that a library function couldn't? Tomek what about static assert?