Re: regexex, enforce and purity

2012-09-10 Thread monarch_dodra
Thank you both for your replies, they make perfect sense. I filed a bug report here: http://d.puremagic.com/issues/show_bug.cgi?id=8637

Re: regexex, enforce and purity

2012-09-09 Thread Dmitry Olshansky
On 09-Sep-12 23:04, monarch_dodra wrote: > Given this little program testing regexs, I decided to replace one of > the example's assert with an enforce: > > > import std.regex; > import std.exception; > void main() > { > auto m = match("hello world", regex("world")); > assert(m)

Re: regexex, enforce and purity

2012-09-09 Thread Jonathan M Davis
On Sunday, September 09, 2012 21:04:58 monarch_dodra wrote: > So I'll rephrase my 1): > Why the difference in behavior regarding the return value? Is it > just historical/no real reason, or is there something for me to > learn here? Just look at the examples. You're supposed to be able to use enfo

regexex, enforce and purity

2012-09-09 Thread monarch_dodra
Given this little program testing regexs, I decided to replace one of the example's assert with an enforce: import std.regex; import std.exception; void main() { auto m = match("hello world", regex("world")); assert(m); enforce(m); // <-- HERE enforce(cast(bool)m); e