Re: xcb error for core.thread's Thread.join

2014-12-28 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/12/2014 7:39 p.m., Jeremy DeHaan wrote: On Monday, 29 December 2014 at 06:34:02 UTC, Jeremy DeHaan wrote: On Monday, 29 December 2014 at 06:26:04 UTC, Jeremy DeHaan wrote: Hey all, I've never gotten any xcb errors with just regular D code before, but maybe I just haven't done anything th

Re: xcb error for core.thread's Thread.join

2014-12-28 Thread Jeremy DeHaan via Digitalmars-d-learn
On Monday, 29 December 2014 at 06:34:02 UTC, Jeremy DeHaan wrote: On Monday, 29 December 2014 at 06:26:04 UTC, Jeremy DeHaan wrote: Hey all, I've never gotten any xcb errors with just regular D code before, but maybe I just haven't done anything that would have caused them. I can't say I ac

Re: xcb error for core.thread's Thread.join

2014-12-28 Thread Jeremy DeHaan via Digitalmars-d-learn
On Monday, 29 December 2014 at 06:26:04 UTC, Jeremy DeHaan wrote: Hey all, I've never gotten any xcb errors with just regular D code before, but maybe I just haven't done anything that would have caused them. I can't say I actually know much about how these things work, but does D not use x

xcb error for core.thread's Thread.join

2014-12-28 Thread Jeremy DeHaan via Digitalmars-d-learn
Hey all, I've never gotten any xcb errors with just regular D code before, but maybe I just haven't done anything that would have caused them. I can't say I actually know much about how these things work, but does D not use xcb when it does threading on Linux? I'm not really doing anything

Re: Data Frames in D - let's not wait for linear algebra; useful today in finance and Internet of Things

2014-12-28 Thread Vlad Levenfeld via Digitalmars-d-learn
Laeeth - I am not sure exactly what your needs are but I have a fairly complete solution for generic multidimensional interfaces (template-based, bounds checked, RAII-ready, non-integer indices, the whole shebang) that I have been building. Anyway I don't want to spam the forum if I've missed the

Re: Need example of usage DerelictPQ

2014-12-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 28 December 2014 at 08:41:15 UTC, Suliman wrote: import postgres; import database; Those should include the package name: import arsd.postgres; Since it publicly imports the base clas, you don't need to import database yourself. (You do still need to pass all files to dmd though,

Re: Problem with immutables and Template typeof(this)

2014-12-28 Thread AuoroP via Digitalmars-d-learn
> -Original Message- > From: digitalmars-d-learn@puremagic.com > Sent: Sun, 28 Dec 2014 22:21:20 + > To: digitalmars-d-learn@puremagic.com > Subject: Re: Problem with immutables and Template typeof(this) > > On Sunday, 28 December 2014 at 22:07:31 UTC, AuoroP via > Digitalmars-d-lear

Re: Problem with immutables and Template typeof(this)

2014-12-28 Thread AuoroP via Digitalmars-d-learn
> -Original Message- > From: digitalmars-d-learn@puremagic.com > Sent: Sun, 28 Dec 2014 22:18:43 + > To: digitalmars-d-learn@puremagic.com > Subject: Re: Problem with immutables and Template typeof(this) > > On Sunday, 28 December 2014 at 22:07:31 UTC, AuoroP via > Digitalmars-d-lear

Re: opDollar and length

2014-12-28 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 28/12/14 19:21, Tobias Pankrath via Digitalmars-d-learn wrote: To allow slicing for types that don't have a length property but are terminated by a sentinel value, like null terminated strings or single linked lists. It's usefull for multi-dimensional containers as well. Ah, clear. Thanks

Re: Problem with immutables and Template typeof(this)

2014-12-28 Thread Tobias Pankrath via Digitalmars-d-learn
Well, the type is ExampleTemplate. No reason not to write it directly. If you cannot for whatever reason I currently do not see: cast to Unqual!(typeof(this)). See http://dlang.org/phobos/std_traits.html Also: Casting with no Type or CastQual removes any top level const, immutable, shared or in

Re: Problem with immutables and Template typeof(this)

2014-12-28 Thread anonymous via Digitalmars-d-learn
On Sunday, 28 December 2014 at 22:07:31 UTC, AuoroP via Digitalmars-d-learn wrote: I have been trying to figure templates out... template ExampleTemplate(T) { struct ExampleTemplate { T value; // constructor auto this(T value) Constructors don't have return typ

Re: Problem with immutables and Template typeof(this)

2014-12-28 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 14:07:18 -0800 AuoroP via Digitalmars-d-learn wrote: let me give you a riddle: struct ExampleTemplate(T) { T value; auto opAdd (typeof(this) that) inout { import std.traits : Unqual; Unqual!(typeof(this)) result; result.value = this.value+that.val

Re: Problem with immutables and Template typeof(this)

2014-12-28 Thread Tobias Pankrath via Digitalmars-d-learn
On Sunday, 28 December 2014 at 22:07:31 UTC, AuoroP via Digitalmars-d-learn wrote: I have been trying to figure templates out... template ExampleTemplate(T) { struct ExampleTemplate { T value; // constructor auto this(T value) { this.value = v

Problem with immutables and Template typeof(this)

2014-12-28 Thread AuoroP via Digitalmars-d-learn
I have been trying to figure templates out... template ExampleTemplate(T) { struct ExampleTemplate { T value; // constructor auto this(T value) { this.value = value; return this; } // opAdd typeof(this) opAdd

Re: Order of evaluation of post-increment operator

2014-12-28 Thread John Colvin via Digitalmars-d-learn
On Sunday, 28 December 2014 at 20:25:59 UTC, bearophile wrote: John Colvin: I guess there are cases where it's not easily catchable: void foo(int* p0, int* p1) { (*p0)++ = (*p1)++; } what happens when p0 == p1? The undefined code can be found statically, the run-time values are irreleva

Re: Order of evaluation of post-increment operator

2014-12-28 Thread aldanor via Digitalmars-d-learn
On Sunday, 28 December 2014 at 14:51:22 UTC, Gary Willoughby wrote: I was just taking a look at the following poll[1] about the order of evaluation when using the post-increment operator. The following D snippet shows an example. import std.stdio; void main(string[] args)

Re: opDollar and length

2014-12-28 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 19:02:59 +0100 Joseph Rushton Wakeling via Digitalmars-d-learn wrote: > A question that suddenly occurred to me, and I realized I didn't know the > answer. > > Why is it necessary/desirable to define separate .length and .opDollar > methods > for custom types? 'because you

Re: Order of evaluation of post-increment operator

2014-12-28 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 17:34:50 + via Digitalmars-d-learn wrote: > On Sunday, 28 December 2014 at 16:05:32 UTC, bearophile wrote: > > (IMHO it must be). > > Disallowing is an alternative to consider. Even defined behaviour > can be unintuitive and error prone. yep, 13670 times "yep". ;-) sig

Re: `shared Mutex`?

2014-12-28 Thread ketmar via Digitalmars-d-learn
On Sun, 28 Dec 2014 20:21:45 + Aiden via Digitalmars-d-learn wrote: > Thanks for the information. At least I've discovered a reasonably > tidy way of wrapping Mutex up so that it's not quite as painful > casting everything: > > shared class SharedMutex { >private Mutex mutex; > >p

Re: Order of evaluation of post-increment operator

2014-12-28 Thread bearophile via Digitalmars-d-learn
John Colvin: I guess there are cases where it's not easily catchable: void foo(int* p0, int* p1) { (*p0)++ = (*p1)++; } what happens when p0 == p1? The undefined code can be found statically, the run-time values are irrelevant. Bye, bearophile

Re: `shared Mutex`?

2014-12-28 Thread Aiden via Digitalmars-d-learn
Thanks for the information. At least I've discovered a reasonably tidy way of wrapping Mutex up so that it's not quite as painful casting everything: shared class SharedMutex { private Mutex mutex; private @property Mutex unsharedMutex() { return cast(Mutex)mutex; } this() { m

Re: Order of evaluation of post-increment operator

2014-12-28 Thread bearophile via Digitalmars-d-learn
Marc Schütz: On Sunday, 28 December 2014 at 16:05:32 UTC, bearophile wrote: (IMHO it must be). Disallowing is an alternative to consider. Even defined behaviour can be unintuitive and error prone. Right. Bye, bearophile

Re: Order of evaluation of post-increment operator

2014-12-28 Thread John Colvin via Digitalmars-d-learn
On Sunday, 28 December 2014 at 17:34:52 UTC, Marc Schütz wrote: On Sunday, 28 December 2014 at 16:05:32 UTC, bearophile wrote: (IMHO it must be). Disallowing is an alternative to consider. Even defined behaviour can be unintuitive and error prone. I guess there are cases where it's not easi

Re: opDollar and length

2014-12-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, December 28, 2014 18:21:41 Tobias Pankrath via Digitalmars-d-learn wrote: > On Sunday, 28 December 2014 at 18:12:42 UTC, Joseph Rushton > Wakeling via Digitalmars-d-learn wrote: > > A question that suddenly occurred to me, and I realized I > > didn't know the answer. > > > > Why is it n

Re: opDollar and length

2014-12-28 Thread Tobias Pankrath via Digitalmars-d-learn
On Sunday, 28 December 2014 at 18:12:42 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: A question that suddenly occurred to me, and I realized I didn't know the answer. Why is it necessary/desirable to define separate .length and .opDollar methods for custom types? To allow slic

opDollar and length

2014-12-28 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
A question that suddenly occurred to me, and I realized I didn't know the answer. Why is it necessary/desirable to define separate .length and .opDollar methods for custom types?

Re: Order of evaluation of post-increment operator

2014-12-28 Thread via Digitalmars-d-learn
On Sunday, 28 December 2014 at 16:05:32 UTC, bearophile wrote: (IMHO it must be). Disallowing is an alternative to consider. Even defined behaviour can be unintuitive and error prone.

Re: Order of evaluation of post-increment operator

2014-12-28 Thread bearophile via Digitalmars-d-learn
Gary Willoughby: 2. Is there anywhere this order of evaluation is documented? Currently that code is undefined in D too, and the compiler doesn't even give a compilation error. But Walter has said many times that it will become defined in D (IMHO it must be). Bye, bearophile

Re: Importing a module from another directory

2014-12-28 Thread FrankLike via Digitalmars-d-learn
On Saturday, 27 December 2014 at 17:36:39 UTC, Derix wrote: I try to compile the basic HelloWorld.d example in which I only added import Journal; where Journal is a module I defined in Journal.d in another directory. So I have /home/derix/development/publishing/journal/journal.d and /hom

[std.net.curl] [Windows-only] Peer authentication problem

2014-12-28 Thread Jack via Digitalmars-d-learn
I've encountered this problem back when I was still programming on Windows and I have encountered this again as I guide my friend into compiling a Windows-usable version of my software: http://picpaste.com/pics/10884707_1128873367127279_796341276_n-AEeMhXiv.1419779219.jpg The program has no hic

Re: Order of evaluation of post-increment operator

2014-12-28 Thread Joakim via Digitalmars-d-learn
On Sunday, 28 December 2014 at 14:51:22 UTC, Gary Willoughby wrote: I was just taking a look at the following poll[1] about the order of evaluation when using the post-increment operator. The following D snippet shows an example. import std.stdio; void main(string[] args)

Order of evaluation of post-increment operator

2014-12-28 Thread Gary Willoughby via Digitalmars-d-learn
I was just taking a look at the following poll[1] about the order of evaluation when using the post-increment operator. The following D snippet shows an example. import std.stdio; void main(string[] args) { auto foo = [0, 0]; int i = 0;

Re: `shared Mutex`?

2014-12-28 Thread Meta via Digitalmars-d-learn
On Sunday, 28 December 2014 at 09:24:31 UTC, Aiden wrote: Hello all, This is my first post on these forums. I've been learning D for the past couple of months or so and have been quite impressed by the language thus far. One stumbling block that I have encountered is with using `shared`, and

Re: `shared Mutex`?

2014-12-28 Thread Artur Skawina via Digitalmars-d-learn
On 12/28/14 10:24, Aiden via Digitalmars-d-learn wrote: > Is `shared` in a workable state? No. > Shouldn't Mutex, Condition, etc be shared since they are basically only ever > useful when used in multiple threads? Yes, but there are so many problems with 'shared' that using it that way (even on

`shared Mutex`?

2014-12-28 Thread Aiden via Digitalmars-d-learn
Hello all, This is my first post on these forums. I've been learning D for the past couple of months or so and have been quite impressed by the language thus far. One stumbling block that I have encountered is with using `shared`, and more specifically using `shared` with synchronization tool

Re: Need example of usage DerelictPQ

2014-12-28 Thread Suliman via Digitalmars-d-learn
Adam, I trying to build simple app: import std.stdio; import postgres; import database; void main() { auto db = new PostgreSql("dbname = test2"); foreach(line; db.query("SELECT * FROM customer")) { writeln(line[0], line["customer_id"]); } } and getting n

Re: [std.net.curl] Downloading multiple files using download()

2014-12-28 Thread Jack via Digitalmars-d-learn
On Sunday, 28 December 2014 at 07:52:24 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 28 Dec 2014 07:44:33 + Jack via Digitalmars-d-learn wrote: How does one compile for Windows on a Linux Machine using dub? I've been using the "platform" : ["windows"]" configuration in my dub.json