Re: Static constructors?

2010-07-21 Thread Dave
On 7/21/2010 7:27 PM, awishformore wrote: On 22/07/2010 03:36, Sean Kelly wrote: Make the ctors "shared static this()" -- those are only constructed once when the process starts up. The non-shared static ctors are thread-local. That concept is really weird, though. So this applies to anything

Re: [D1] capitalize cannot be interpreted at CT

2010-07-21 Thread strtr
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article > On 07/21/2010 09:09 PM, strtr wrote: > > Could somebody please explain this error to me. > evidently ctfe can't eat > foreach(i, dchar d; s){ > } > Bleach. Make sure it's in bugzilla. Thanks, found it: http://d.puremagic.com/iss

Re: Is there a way to create compile-time delegates?

2010-07-21 Thread Don
Simen kjaeraas wrote: Sean Kelly wrote: Don Wrote: Philippe Sigaud wrote: > On Mon, Jul 19, 2010 at 22:01, torhu wrote: > > > > I wasn't able to make it work. > > > Me too :( > > > The compiler probably sees delegates as something that just can't be > created at compile time,

Re: associative arrays: to sort or not to sort?

2010-07-21 Thread BCS
Hello Mario, But then, JSON has a jew more unspecified gaps like "whitespace can be inserted between any pair of tokens". That can be dealt with by just being consistent. Shall we rely on the fact that the implementation currently does not insert whitespace between tokens? On the output s

Re: Static constructors?

2010-07-21 Thread awishformore
On 22/07/2010 03:36, Sean Kelly wrote: Make the ctors "shared static this()" -- those are only constructed once when the process starts up. The non-shared static ctors are thread-local. That concept is really weird, though. So this applies to anything static, not just variables?

Re: [D1] capitalize cannot be interpreted at CT

2010-07-21 Thread Ellery Newcomer
On 07/21/2010 09:09 PM, strtr wrote: Could somebody please explain this error to me. evidently ctfe can't eat foreach(i, dchar d; s){ } Bleach. Make sure it's in bugzilla.

[D1] capitalize cannot be interpreted at CT

2010-07-21 Thread strtr
Could somebody please explain this error to me. import std.uni : toUniUpper; import std.string : capitalize; void main() { const char[] name = `test`; // C:\dmd\src\phobos\std\string.d(983): Error: _aApplycd2 cannot be interpreted at compile time, because it has no available

Re: Static constructors?

2010-07-21 Thread Sean Kelly
Make the ctors "shared static this()" -- those are only constructed once when the process starts up. The non-shared static ctors are thread-local.

Static constructors?

2010-07-21 Thread awishformore
I have a question to static constructors in D2 and with threads. -LogManager.d- import std.stdio; final class LogManager { private: static __gshared LogManager instance; public: static this() {

Re: associative arrays: to sort or not to sort?

2010-07-21 Thread Mario Kroeplin
> >> the correct solution is to make the check order independent. For > >> example: > >> string s = CallReturningJSON(); > >> s = replace(s,`"a":23.54`, `X`); > >> s = replace(s,`"b":0.0012`, `X`); > >> s = replace(s,`{"nested":{X,X}}`, `X`); > >> s = replace(s,`"goodbye":[true,"or",false,["test",4

Re: Is there a way to create compile-time delegates?

2010-07-21 Thread Simen kjaeraas
Sean Kelly wrote: Don Wrote: Philippe Sigaud wrote: > On Mon, Jul 19, 2010 at 22:01, torhu wrote: > > > > I wasn't able to make it work. > > > Me too :( > > > The compiler probably sees delegates as something that just can't be > created at compile time, since no runtime conte

Re: Is there a way to create compile-time delegates?

2010-07-21 Thread Sean Kelly
Don Wrote: > Philippe Sigaud wrote: > > On Mon, Jul 19, 2010 at 22:01, torhu wrote: > > > > > > > > I wasn't able to make it work. > > > > > > Me too :( > > > > > > The compiler probably sees delegates as something that just can't be > > created at compile time, since no run

Re: spawning a thread in a class

2010-07-21 Thread Sean Kelly
Mike James Wrote: > > I'm using the std.concurrency in Phobos to do the threading in the new > version but I'm having problems passing the address of the receive handler. > Are there any solutions to this - without making the receive handler static > or outside the class :-) Not at the moment

Re: associative arrays: to sort or not to sort?

2010-07-21 Thread BCS
Hello Mario, Unless JSON requiers that the keys be in some order, No, JSON does not require the names of an object to be in alphabetical order. the correct solution is to make the check order independent. For example: string s = CallReturningJSON(); s = replace(s,`"a":23.54`, `X`); s = repla

spawning a thread in a class

2010-07-21 Thread Mike James
I have some old serial comms code written in D1 + Tango and I'm going through the process of re-writing it for D2 + Phobos. The old code used Thread from the Tango library... private Thread rxThread; ... open() { ... rxThread = new Thread(&rxHandler); rxThread.start(); ... } private

Re: const(type) vs. const type

2010-07-21 Thread Mike Linford
Thanks for the responses guys, I appreciate it. -- Mike Linford