Re: Installing DUB on OSX

2016-02-17 Thread Joel via Digitalmars-d-learn
On Thursday, 18 February 2016 at 07:11:23 UTC, Joel wrote: I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem, but where do you put it (also I tried one place, but couldn't put it in that folder)? I've now tried 'brew install dub' and

Enforcing checks for return code

2016-02-17 Thread Chris Katko via Digitalmars-d-learn
Hello. I'm almost brand-new to the D language and still absorbing things. I'm wondering if it's possible to fire off a compile-time (or worst case, a run-time) warning or error if a function is called, but the return value is not checked. I'm not trying to enforce whether someone actually

Installing DUB on OSX

2016-02-17 Thread Joel via Digitalmars-d-learn
I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem, but where do you put it (also I tried one place, but couldn't put it in that folder)?

Re: Arrays of noncopyables/Invalid memory operation

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 18 February 2016 at 01:19:16 UTC, Ali Çehreli wrote: On 02/17/2016 05:14 PM, ZombineDev wrote: > The "Invalid memory operation" error is thrown only by the GC (AFAIK) > when the user tries something unsupported like allocating or freeing in > a destructor, while a GC collection is

Re: ndslice help

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 18 February 2016 at 00:25:09 UTC, Zz wrote: Hi, I'm trying to generate the following sequences with ndslice. 0 0 0 1 1 1 1 1 1 0 0 0 0 1 2 0 1 2 2 1 0 2 1 0 It's okay with loops but was checking to see if it's possible with ndslice. Zz Here's my solution:

Re: Arrays of noncopyables/Invalid memory operation

2016-02-17 Thread Ali Çehreli via Digitalmars-d-learn
On 02/17/2016 05:14 PM, ZombineDev wrote: > The "Invalid memory operation" error is thrown only by the GC (AFAIK) > when the user tries something unsupported like allocating or freeing in > a destructor, while a GC collection is being run. That. The problem is when the assert check fails (for

Re: Arrays of noncopyables/Invalid memory operation

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 22:20:00 UTC, Matt Elkins wrote: So in a different thread someone mentioned that when arrays are grown an implicit copy could be called on all the elements, as they might need to be copied over to a new, larger block of memory. This makes sense, and is

Re: Confusion regarding struct lifecycle

2016-02-17 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 16:36:35 UTC, Matt Elkins wrote: On Wednesday, 17 February 2016 at 07:10:15 UTC, ZombineDev wrote: The downside is that it really indicates that I didn't reduce my buggy program properly. I'll hold out for the live-object-destructor-call fix to see whether

ndslice help

2016-02-17 Thread Zz via Digitalmars-d-learn
Hi, I'm trying to generate the following sequences with ndslice. 0 0 0 1 1 1 1 1 1 0 0 0 0 1 2 0 1 2 2 1 0 2 1 0 It's okay with loops but was checking to see if it's possible with ndslice. Zz

Arrays of noncopyables/Invalid memory operation

2016-02-17 Thread Matt Elkins via Digitalmars-d-learn
So in a different thread someone mentioned that when arrays are grown an implicit copy could be called on all the elements, as they might need to be copied over to a new, larger block of memory. This makes sense, and is expected. However, it got me concerned: what if the post-blit was disabled

Re: An unexpected string to int exception.

2016-02-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 17, 2016 at 11:16:50AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 02/17/2016 11:08 AM, H. S. Teoh via Digitalmars-d-learn wrote: > > >> For example, the 'h' below was typed by my own right-hand index > >> finger. :) > >> > >>Error: Unexpected 'h' when converting from

Re: Confusion regarding struct lifecycle

2016-02-17 Thread anonymous via Digitalmars-d-learn
On 17.02.2016 17:36, Matt Elkins wrote: I tried this, and got the same issue. Actually, I was still able to reproduce the original reported issue as well, which leads me to believe either the bug was not actually fixed or (and this is more likely) I screwed something up with my install. Do I

Re: Confusion regarding struct lifecycle

2016-02-17 Thread Ali Çehreli via Digitalmars-d-learn
On 02/17/2016 11:37 AM, anonymous wrote: > However, the code from this thread still prints > > > Before 8 > Before 1 > Foo being destroyed: 0 > Before 2 > Foo being destroyed: 0 > Before 3 > Foo being destroyed: 0 > After Foo construction > About to lose scope > Foo being destroyed: 0 > Foo

Re: An unexpected string to int exception.

2016-02-17 Thread Ali Çehreli via Digitalmars-d-learn
On 02/17/2016 11:08 AM, H. S. Teoh via Digitalmars-d-learn wrote: >> For example, the 'h' below was typed by my own right-hand index >> finger. :) >> >>Error: Unexpected 'h' when converting from type string to type uint > [...] > > So where's the bug report?? ;-) That's the shame part. :) I

Re: Running task once a day in vibe.d

2016-02-17 Thread Chris Wright via Digitalmars-d-learn
On Wed, 17 Feb 2016 18:55:42 +, Zardoz wrote: > On Tuesday, 16 February 2016 at 18:30:43 UTC, Nick wrote: >> Hey folks >> >> I'm making a vibe.d application. Once a day it needs to download some >> data. How do i get the program to perform this task once a day? >> >> Regards, Nick > > Why

Re: An unexpected string to int exception.

2016-02-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 17, 2016 at 10:44:40AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 02/17/2016 09:09 AM, H. S. Teoh via Digitalmars-d-learn wrote: > > >> apparently std.conv parse() will say the unexpected input is not > >> the one that caused the error but the character after. in this

Re: Running task once a day in vibe.d

2016-02-17 Thread Zardoz via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 18:30:43 UTC, Nick wrote: Hey folks I'm making a vibe.d application. Once a day it needs to download some data. How do i get the program to perform this task once a day? Regards, Nick Why you not use cron to launch your program at desire time every day ?

Re: An unexpected string to int exception.

2016-02-17 Thread Ali Çehreli via Digitalmars-d-learn
On 02/17/2016 09:09 AM, H. S. Teoh via Digitalmars-d-learn wrote: >> apparently std.conv parse() will say the unexpected input is not the >> one that caused the error but the character after. in this case "g1" >> only the 1 was reported. > > Please file a bug, I'll look into making a fix for it.

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-17 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 01:45:24 UTC, Rikki Cattermole wrote: On 17/02/16 1:19 PM, Seb wrote: In any case such a next method would be very easy to implement (see below) and thus I am wondering why it isn't part of phobos? ``` auto next(Range)(ref Range a){ auto b = a.front;

Re: An unexpected string to int exception.

2016-02-17 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 17, 2016 at 04:38:34PM +, Taylor Hillegeist via Digitalmars-d-learn wrote: > On Wednesday, 17 February 2016 at 16:13:47 UTC, Taylor Hillegeist wrote: > >On Wednesday, 17 February 2016 at 16:11:44 UTC, Taylor Hillegeist wrote: > >>I think the following error message says it all. >

Re: An unexpected string to int exception.

2016-02-17 Thread Taylor Hillegeist via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 16:13:47 UTC, Taylor Hillegeist wrote: On Wednesday, 17 February 2016 at 16:11:44 UTC, Taylor Hillegeist wrote: I think the following error message says it all. std.conv.ConvException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2002): Unexpected '1'

Re: Confusion regarding struct lifecycle

2016-02-17 Thread Matt Elkins via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 07:10:15 UTC, ZombineDev wrote: The downside is that it really indicates that I didn't reduce my buggy program properly. I'll hold out for the live-object-destructor-call fix to see whether that corrects my problem; I can just leak resources until then :).

Re: An unexpected string to int exception.

2016-02-17 Thread Taylor Hillegeist via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 16:11:44 UTC, Taylor Hillegeist wrote: I think the following error message says it all. std.conv.ConvException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2002): Unexpected '1' when converting from type string to type int I would expect that 1 would be

An unexpected string to int exception.

2016-02-17 Thread Taylor Hillegeist via Digitalmars-d-learn
I think the following error message says it all. std.conv.ConvException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2002): Unexpected '1' when converting from type string to type int I would expect that 1 would be among the group of expected items.

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 17, 2016 00:19:09 Seb via Digitalmars-d-learn wrote: > I am still in the process of learning D - it's a fantastic > language. Thanks so much! > However there is one thing that I came by which I think is a bit > annoying and could be easily solved - there seems to be no way

Re: Running task once a day in vibe.d

2016-02-17 Thread Nick via Digitalmars-d-learn
Thank you very much, this was exactly what I was looking for!

Re: Confusion regarding struct lifecycle

2016-02-17 Thread Ali Çehreli via Digitalmars-d-learn
dmd's behaviour is too confusing to accept. :) Filed: https://issues.dlang.org/show_bug.cgi?id=15694 Ali