"H. S. Teoh" wrote in message
news:mailman.2061.1335131543.4860.digitalmar...@puremagic.com...
>
> It's my fault. I really should be using module globals for those
> regexes, and a module ctor (static this) for initializing them.
>
In most cases, I've come to prefer lazy initalization (via a mod
On Sun, Apr 22, 2012 at 12:31:16PM +0200, SomeDude wrote:
> On Saturday, 21 April 2012 at 14:40:00 UTC, H. S. Teoh wrote:
[...]
> >Hmph. I should've checked dmd memory usage when I wrote that. :-(
> >
> >But anyway, even on my souped up AMD hexacore system, the ctRegex
> >version takes significantl
On Saturday, 21 April 2012 at 14:40:00 UTC, H. S. Teoh wrote:
On Sat, Apr 21, 2012 at 03:12:05PM +0400, Dmitry Olshansky
wrote:
On 21.04.2012 14:48, SomeDude wrote:
>On Saturday, 21 April 2012 at 10:21:49 UTC, Dmitry Olshansky
>wrote:
>>Just stop using ctRegex for now... it's experimental.
>>
On Sat, Apr 21, 2012 at 06:17:58PM +0200, nhk wrote:
> Please bear with my ignorance I'm new to D, but why is that any
> better compared to a simple
>
> switch(key){
> default: throw Exception("Invalid attribute '%s'".format(key));
> case "name": d.name = value;
>break;
> ...
> ...
On Saturday, 21 April 2012 at 14:40:00 UTC, H. S. Teoh wrote:
I'm getting confused about the use of 'static' in this context.
What I
wanted was to make the regex module-global, but apparently
'static' has
an overloaded meaning here, and also makes it compile-time
evaluated?
How do I make it mod
On 21.04.2012 18:41, H. S. Teoh wrote:
[snip]
How do I make it module-global without being compile-time evaluated??
No idea ;)
But as a workaround:
Global blah;
static this(){
blah = ...;
}
--
Dmitry Olshansky
Please bear with my ignorance I'm new to D, but why is that any
better compared to a simple
switch(key){
default: throw Exception("Invalid attribute '%s'".format(key));
case "name": d.name = value;
break;
...
...
}
On Friday, 20 April 2012 at 04:05:43 UTC, H. S. Teoh wrote:
I'm
On 2012-04-20 20:50, Arne wrote:
auto dgs =
[
"name": (string value) {d.name = value; },
"phone": (string value) => cast(void)(d.phone = value),
"age": (string value) => cast(void)(d.age = value.to!int()),
];
This works... is there a better way, to avoid cast?
You could try explicitly declare
On Sat, Apr 21, 2012 at 03:12:05PM +0400, Dmitry Olshansky wrote:
> On 21.04.2012 14:48, SomeDude wrote:
> >On Saturday, 21 April 2012 at 10:21:49 UTC, Dmitry Olshansky wrote:
> >>Just stop using ctRegex for now... it's experimental.
> >>
> >>Or more to the point the problem is this. I've seen this
On 21.04.2012 14:48, SomeDude wrote:
On Saturday, 21 April 2012 at 10:21:49 UTC, Dmitry Olshansky wrote:
Just stop using ctRegex for now... it's experimental.
Or more to the point the problem is this. I've seen this one on bugzilla:
version(CtRgx) {
enum Re = ctRegex!re;//auto is OK here BTW
}
On Saturday, 21 April 2012 at 10:21:49 UTC, Dmitry Olshansky
wrote:
Just stop using ctRegex for now... it's experimental.
Or more to the point the problem is this. I've seen this one on
bugzilla:
version(CtRgx) {
enum Re = ctRegex!re;//auto is OK here BTW
} else {//tha
On 21.04.2012 11:46, SomeDude wrote:
I can't compile it. I get "Out of memory". Is it the regex.d module
again ?:(
This one really needs to be fixed ASAP, as the older working
Ah-ha-ha. OK, come on use it the source are out there in the open :)
It didn't even handle * properly.
regexp is
dep
On Friday, 20 April 2012 at 19:00:29 UTC, Nick Sabalausky wrote:
"Arne" wrote in message
news:qmehxgyksrdxkabvc...@forum.dlang.org...
auto dgs =
[
"name": (string value) {d.name = value; },
"phone": (string value) => cast(void)(d.phone = value),
"age": (string value) => cast(void)(d.a
I can't compile it. I get "Out of memory". Is it the regex.d
module again ?:(
This one really needs to be fixed ASAP, as the older working
regexp is deprecated.
On Fri, Apr 20, 2012 at 04:25:30PM +0200, ixid wrote:
> As a D learner this thread is very interesting. It would be great to
> maintain it with a polished and error catching version that
> incorporates people's tweaks.
What I posted was a pared-down simplified version of the actual code I
was work
"Arne" wrote in message
news:qmehxgyksrdxkabvc...@forum.dlang.org...
>
> auto dgs =
> [
> "name": (string value) {d.name = value; },
> "phone": (string value) => cast(void)(d.phone = value),
> "age": (string value) => cast(void)(d.age = value.to!int()),
> ];
>
> This works... is there
On 04/20/2012 11:50 AM, Arne wrote:
On Friday, 20 April 2012 at 11:23:49 UTC, Steven Schveighoffer wrote:
On Fri, 20 Apr 2012 00:06:41 -0400, H. S. Teoh
wrote:
The only complaint is that I couldn't write auto[string] dgs and have
the compiler auto-infer the delegate type. :-)
Does this not
On Friday, 20 April 2012 at 11:23:49 UTC, Steven Schveighoffer
wrote:
On Fri, 20 Apr 2012 00:06:41 -0400, H. S. Teoh
wrote:
The only complaint is that I couldn't write auto[string] dgs
and have
the compiler auto-infer the delegate type. :-)
Does this not work?
auto dgs = ...
Also, it do
As a D learner this thread is very interesting. It would be great
to maintain it with a polished and error catching version that
incorporates people's tweaks.
On Fri, 20 Apr 2012 00:06:41 -0400, H. S. Teoh
wrote:
The only complaint is that I couldn't write auto[string] dgs and have
the compiler auto-infer the delegate type. :-)
Does this not work?
auto dgs = ...
Also, it doesn't look like that needs to be in the inner loop. Each time
you sp
On 2012-04-20 06:06, H. S. Teoh wrote:
I'm writing some code that does some very simplistic parsing, and I'm
just totally geeking out on how awesome D is for writing such code:
import std.conv;
import std.regex;
import std.stdio;
struct Data {
str
On 20.04.2012 8:44, Denis Shelomovskij wrote:
20.04.2012 8:06, H. S. Teoh написал:
I'm writing some code that does some very simplistic parsing, and I'm
just totally geeking out on how awesome D is for writing such code:
import std.conv;
import std.regex;
import std.stdio;
struct Data {
string
On 20.04.2012 9:19, F i L wrote:
Denis Shelomovskij wrote:
A shorter variant:
---
void delegate(string, string)[string] dgs = [
"name" : (key, value) { d.name = value; },
"phone": (key, value) { d.phone = value; },
"age" : (key, value) { d.age = to!int(value); },
... // whole bunch of other stuf
On 4/20/12 1:09 PM, H. S. Teoh wrote:
On Fri, Apr 20, 2012 at 08:44:06AM +0400, Denis Shelomovskij wrote:
20.04.2012 8:06, H. S. Teoh написал:
I'm writing some code that does some very simplistic parsing, and I'm
just totally geeking out on how awesome D is for writing such code:
impor
Denis Shelomovskij wrote:
A shorter variant:
---
void delegate(string, string)[string] dgs = [
"name" : (key, value) { d.name = value; },
"phone": (key, value) { d.phone = value; },
"age" : (key, value) { d.age = to!int(value); },
... // whole bunch of other s
Denis Shelomovskij wrote:
A shorter variant:
---
void delegate(string, string)[string] dgs = [
"name" : (key, value) { d.name = value; },
"phone": (key, value) { d.phone = value; },
"age" : (key, value) { d.age = to!int(value); },
... // whole bunch of other s
"H. S. Teoh" wrote in message
news:mailman.1957.1334898572.4860.digitalmar...@puremagic.com...
>
> Good idea, I really need to work on my delegate syntax. I must admit I
> still have to look it up each time, 'cos I just can't remember the right
> syntax with all its shorthands thereof.
>
Heh, I
On Fri, Apr 20, 2012 at 08:44:06AM +0400, Denis Shelomovskij wrote:
> 20.04.2012 8:06, H. S. Teoh написал:
> >I'm writing some code that does some very simplistic parsing, and I'm
> >just totally geeking out on how awesome D is for writing such code:
> >
> > import std.conv;
> > import std.
20.04.2012 8:06, H. S. Teoh написал:
I'm writing some code that does some very simplistic parsing, and I'm
just totally geeking out on how awesome D is for writing such code:
import std.conv;
import std.regex;
import std.stdio;
struct Data {
strin
"H. S. Teoh" wrote in message
news:mailman.1953.1334894800.4860.digitalmar...@puremagic.com...
> I'm writing some code that does some very simplistic parsing, and I'm
> just totally geeking out on how awesome D is for writing such code:
>
Heh, yup :)
I grew up on C/C++ (well, after outgrowing B
I'm writing some code that does some very simplistic parsing, and I'm
just totally geeking out on how awesome D is for writing such code:
import std.conv;
import std.regex;
import std.stdio;
struct Data {
string name;
string phone;
31 matches
Mail list logo