Re: sleepy receiveTimeout?

2010-12-19 Thread Nick Voronin
On Sat, 18 Dec 2010 23:19:47 +0100 Joost 't Hart joost.t.h...@planet.nl wrote: Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my friend to end up in cyberspace. :-) Nope,

Re: sleepy receiveTimeout?

2010-12-19 Thread Jérôme M. Berger
Nick Voronin wrote: On Sat, 18 Dec 2010 23:19:47 +0100 Joost 't Hart joost.t.h...@planet.nl wrote: Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my friend to end up in

Re: define methods apart

2010-12-19 Thread Christopher Nicholson-Sauls
On 12/18/10 07:19, spir wrote: Hello, I cannot find a way to define methods (I mean member functions) outside the main type-definition body: struct X {} void X.say () {writeln(I say!);} == Element.d(85): semicolon expected, not '.' Do I overlook anything, or is this simply

Re: sleepy receiveTimeout?

2010-12-19 Thread Joost 't Hart
On 12/19/2010 09:56 AM, Nick Voronin wrote: On Sat, 18 Dec 2010 23:19:47 +0100 Joost 't Hartjoost.t.h...@planet.nl wrote: Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my

Re: sleepy receiveTimeout?

2010-12-19 Thread Nick Voronin
On Sun, 19 Dec 2010 10:50:08 +0100 Joost 't Hart joost.t.h...@planet.nl wrote: Quoting the documentation: /Suspends the calling thread for at least the supplied period./ What does at least mean here? Is there also an at most? I do not want my friend to end up in cyberspace. :-)

Re: define methods apart

2010-12-19 Thread spir
On Sun, 19 Dec 2010 03:37:37 -0600 Christopher Nicholson-Sauls ibisbase...@gmail.com wrote: On 12/18/10 07:19, spir wrote: Hello, I cannot find a way to define methods (I mean member functions) outside the main type-definition body: struct X {} void X.say () {writeln(I

Re: opAssign work not with initialisation?

2010-12-19 Thread Adam Burton
spir wrote: On Sat, 18 Dec 2010 13:08:14 + Adam Burton adz...@gmail.com wrote: struct S { int value; void opAssign(int value) { this.value = value; } } unittest { S s1; s1 = 3;// OK S s2 = 3; // _build_ error } ==

Classes or stucts :: Newbie

2010-12-19 Thread David Currie
I am new to D (like many have done C++ , Java ). Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2; public: this(int pI) // constructor { _I1 = pI; _I2 = pI + 1; } // ... other methods etc } void f() // just a function { C

Re: Classes or stucts :: Newbie

2010-12-19 Thread Denis Koroskin
On Mon, 20 Dec 2010 18:00:31 +0300, David Currie curri...@iinet.net.au wrote: I am new to D (like many have done C++ , Java ). Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2; public: this(int pI) // constructor { _I1 = pI;

Re: Classes or stucts :: Newbie

2010-12-19 Thread Denis Koroskin
On Mon, 20 Dec 2010 18:00:31 +0300, David Currie curri...@iinet.net.au wrote: I am new to D (like many have done C++ , Java ). Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2; public: this(int pI) // constructor { _I1 = pI;

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
David Currie: I am new to D (like many have done C++ , Java ). Welcome to D :-) What language do you refer to, D1 or D2? The answers here are about the latest versions of D2. Can a class be instantiated on the stack ? There was a way built in the language to do that (using scope, it works

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
Denis Koroskin: Unfortunately last I've heard it's going to be deprecated in favor of a library solution: InSitu!(C) c = InSitu!(C)(3); // IIRC not implemented yet It's named scoped, see about its problems: http://d.puremagic.com/issues/show_bug.cgi?id=5115 Bye, bearophile

Re: Classes or stucts :: Newbie

2010-12-19 Thread Joost 't Hart
On 12/20/2010 04:00 PM, David Currie wrote: I am new to D (like many have done C++ , Java ). Me too. Let's see what we can figure out together :-) Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2; public: this(int pI) // constructor { _I1 = pI;

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
See the std.conv.emplace, Sorry, see std.typecons.scoped and its problems: http://d.puremagic.com/issues/show_bug.cgi?id=5115 Bye, bearophile

Re: Classes or stucts :: Newbie

2010-12-19 Thread Andrej Mitrovic
There's also scoped() in std.typecons, but I think this will still allocate on the heap. Not sure.. On 12/19/10, bearophile bearophileh...@lycos.com wrote: David Currie: I am new to D (like many have done C++ , Java ). Welcome to D :-) What language do you refer to, D1 or D2? The answers

Re: Classes or stucts :: Newbie

2010-12-19 Thread Andrej Mitrovic
On 12/19/10, bearophile bearophileh...@lycos.com wrote: See the std.conv.emplace, Sorry, see std.typecons.scoped and its problems: http://d.puremagic.com/issues/show_bug.cgi?id=5115 Bye, bearophile Is this another bug?: import std.stdio; import std.typecons; class A { ~this() {

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
Andrej Mitrovic: There's also scoped() in std.typecons, but I think this will still allocate on the heap. Not sure.. It allocates on the stack. Bye, bearophile

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
Andrej Mitrovic: Is this another bug?: I don't exactly know what's going on, but I have added a modified version of your code to the issue 5115. Bye, bearophile

Re: Classes or stucts :: Newbie

2010-12-19 Thread Nick Voronin
On Mon, 20 Dec 2010 07:00:31 -0800 David Currie curri...@iinet.net.au wrote: Can a class be instantiated on the stack ? Yes, check std.conv.emplace http://www.digitalmars.com/d/2.0/phobos/std_conv.html#emplace and alloca() I don't know details about interaction of such objects with GC though.

Re: Classes or stucts :: Newbie

2010-12-19 Thread Jonathan M Davis
On Monday 20 December 2010 07:00:31 David Currie wrote: I am new to D (like many have done C++ , Java ). Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2; public: this(int pI) // constructor { _I1 = pI; _I2 =

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
Jonathan M Davis: There will be a library solution to do it, but again, it's unsafe. It can be safer if the compiler gives some help. For me it's one of the important unfinished parts of D. Bye, bearophile

Re: Classes or stucts :: Newbie

2010-12-19 Thread Jonathan M Davis
On Sunday 19 December 2010 13:23:42 Jonathan M Davis wrote: On Monday 20 December 2010 07:00:31 David Currie wrote: I am new to D (like many have done C++ , Java ). Can a class be instantiated on the stack ? eg class C { private int _I1; private int _I2;

Re: Classes or stucts :: Newbie

2010-12-19 Thread Jonathan M Davis
On Sunday 19 December 2010 14:26:19 bearophile wrote: Jonathan M Davis: There will be a library solution to do it, but again, it's unsafe. It can be safer if the compiler gives some help. For me it's one of the important unfinished parts of D. Whereas, I would argue that it's completely

rdmd bug?

2010-12-19 Thread CrypticMetaphor
Hello, I'm being driven nuts by this problem, I don't know 100% if it's it's a bug or if it's intended behavior, I'm new to D( also new to reporting bugs ) so I can't really tell. Anyway, the problem is, if I call rdmd from outside the folder in which the main source resides in, and main

Re: Classes or stucts :: Newbie

2010-12-19 Thread Nick Voronin
On Sun, 19 Dec 2010 14:38:17 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday 19 December 2010 14:26:19 bearophile wrote: Jonathan M Davis: There will be a library solution to do it, but again, it's unsafe. It can be safer if the compiler gives some help. For me it's one of

Re: Classes or stucts :: Newbie

2010-12-19 Thread Andrej Mitrovic
On 12/20/10, Nick Voronin elfy...@gmail.com wrote: I see two aspects there: first is having destructor called at known point rather than arbitrarily, second is performance. There's still an alternative for the first part, scope(exit): import std.stdio; class A { ~this() {

Re: Classes or stucts :: Newbie

2010-12-19 Thread Jonathan M Davis
On Sunday 19 December 2010 16:50:34 Nick Voronin wrote: On Sun, 19 Dec 2010 14:38:17 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday 19 December 2010 14:26:19 bearophile wrote: Jonathan M Davis: There will be a library solution to do it, but again, it's unsafe. It

Re: rdmd bug?

2010-12-19 Thread Nick Voronin
On Mon, 20 Dec 2010 01:24:02 +0100 CrypticMetaphor crypticmetapho...@gmail.com wrote: Anyway, the problem is, if I call rdmd from outside the folder in which the main source resides in, and main includes another file in that folder, I get an error. // If I'm in a shell, and I do this, I

Re: rdmd bug?

2010-12-19 Thread CrypticMetaphor
Add -Ifullpath_to_projectfolder\src. It's the way it works IMHO, if you import something it must be relative to search path or to current dir. There may be a better way (replace current dir with the dir where source is, but it will take away control), but this works. There is a bug though,

Re: rdmd bug?

2010-12-19 Thread CrypticMetaphor
So, should I report this as a bug? What am i saying!? of course I should. It annoyed the hell outta me _ *goes to report*

Re: Classes or stucts :: Newbie

2010-12-19 Thread Nick Voronin
On Sun, 19 Dec 2010 17:26:20 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday 19 December 2010 16:50:34 Nick Voronin wrote: On Sun, 19 Dec 2010 14:38:17 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday 19 December 2010 14:26:19 bearophile wrote: Jonathan M

Re: Classes or stucts :: Newbie

2010-12-19 Thread Jonathan M Davis
On Sunday 19 December 2010 18:13:54 Nick Voronin wrote: On Sun, 19 Dec 2010 17:26:20 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday 19 December 2010 16:50:34 Nick Voronin wrote: On Sun, 19 Dec 2010 14:38:17 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On

Re: Classes or stucts :: Newbie

2010-12-19 Thread bearophile
Jonathan M Davis: Whereas, I would argue that it's completely unnecessary. Recently even the Oracle Java VM allocates some class instances on the stack, when Escape Analysis finds it's safe to do so. And D lacks the very efficient GC of the JVM, so for D it's even more important to use the

Re: Classes or stucts :: Newbie

2010-12-19 Thread Jonathan M Davis
On Sunday 19 December 2010 18:33:56 bearophile wrote: Jonathan M Davis: Whereas, I would argue that it's completely unnecessary. Recently even the Oracle Java VM allocates some class instances on the stack, when Escape Analysis finds it's safe to do so. And D lacks the very efficient GC of

Re: string comparison

2010-12-19 Thread doubleagent
Compared to the relatively snappy response other threads have been receiving I'm going to assume that nobody is interested in my inquiry. That's cool. Can anybody point me to an IRC chatroom for D noobs, and is there anywhere to post errata for the book?

Re: string comparison

2010-12-19 Thread Jonathan M Davis
On Saturday 18 December 2010 23:01:30 doubleagent wrote: Andrei's quick dictionary illustration [in his book, 'The D Programming Language'] doesn't seem to work. Code attached. On my computer, with d2-0.5.0, I got the following output while testing. andrei 0 andrei andrei 1

Re: string comparison

2010-12-19 Thread Denis Koroskin
Check your client setting, everything is perfect on my side (Opera built-in news client).