gdc-6.3.0 on travis borked?

2017-11-30 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
When using gdc-6.3.0 on travis-ci, travis is reporting that it can't download the compiler: -- $ source "$(CURL_USER_AGENT="$CURL_USER_AGENT" bash install.sh gdc-6.3.0 --activate)" curl: (22) The requested URL returned error: 404 Not Found

Re: Template specialisation, "Generic type locking", offline stdlib docs and case-based template question

2017-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, December 01, 2017 03:39:12 helxi via Digitalmars-d-learn wrote: > 1. Template specialisation. > Why is this useful?: > T getResponse(T = int)(string question); And how does it differ > from > int getResponse(string question); ? > > Context: http://ddili.org/ders/d.en/templates.html : Sec

Re: Template specialisation, "Generic type locking", offline stdlib docs and case-based template question

2017-11-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 1 December 2017 at 03:39:12 UTC, helxi wrote: 1. Template specialisation. Why is this useful?: T getResponse(T = int)(string question); And how does it differ from int getResponse(string question); ? Because you can change the T at the call site. Let me give you a real world exam

Re: Template specialisation, "Generic type locking", offline stdlib docs and case-based template question

2017-11-30 Thread user1234 via Digitalmars-d-learn
On Friday, 1 December 2017 at 03:39:12 UTC, helxi wrote: 1. Template specialisation. Why is this useful?: T getResponse(T = int)(string question); And how does it differ from int getResponse(string question); ? Good Q. Without thinking more it looks like a pointless example. The only differe

Template specialisation, "Generic type locking", offline stdlib docs and case-based template question

2017-11-30 Thread helxi via Digitalmars-d-learn
1. Template specialisation. Why is this useful?: T getResponse(T = int)(string question); And how does it differ from int getResponse(string question); ? Context: http://ddili.org/ders/d.en/templates.html : Section: "Default template parameters" 2. "Generic locking". Is it possible to specia

Re: associative array: unexpected results after static initialization

2017-11-30 Thread H. S. Teoh via Digitalmars-d-learn
Seems like this problem is already known: https://issues.dlang.org/show_bug.cgi?id=15290 Here's the fix: https://github.com/dlang/druntime/pull/1980 --T

Re: associative array: unexpected results after static initialization

2017-11-30 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 30, 2017 at 03:57:37PM -0800, H. S. Teoh via Digitalmars-d-learn wrote: > Hmm, which compiler are you using, and which version? I cannot > reproduce this bug with DMD git head. It may be have fixed since the > release you're using? [...] Sorry, I was testing the wrong code. This pr

Re: associative array: unexpected results after static initialization

2017-11-30 Thread H. S. Teoh via Digitalmars-d-learn
Hmm, which compiler are you using, and which version? I cannot reproduce this bug with DMD git head. It may be have fixed since the release you're using? --T

Re: associative array: unexpected results after static initialization

2017-11-30 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 30, 2017 at 11:50:13PM +, kdevel via Digitalmars-d-learn wrote: > This program > > ``` void aa_stat(T, U) (T[U] aa) { import std.stdio; writefln ("aa > : %s", aa); writefln ("aa.length : %d", aa.length); writefln ("aa.keys > : %s", aa.keys); writefln ("aa.values : %s", aa.values);

associative array: unexpected results after static initialization

2017-11-30 Thread kdevel via Digitalmars-d-learn
This program ``` void aa_stat(T, U) (T[U] aa) { import std.stdio; writefln ("aa: %s", aa); writefln ("aa.length : %d", aa.length); writefln ("aa.keys : %s", aa.keys); writefln ("aa.values : %s", aa.values); foreach (k, v; aa) writeln (k, ": ", v); } void main ()

Re: std.algorithm

2017-11-30 Thread flamencofantasy via Digitalmars-d-learn
On Thursday, 30 November 2017 at 21:49:56 UTC, Meta wrote: On Thursday, 30 November 2017 at 20:49:36 UTC, flamencofantasy wrote: [...] This *almost* works: [...] That's what I needed, thanks!

Re: Convert a single element into a range

2017-11-30 Thread A Guy With a Question via Digitalmars-d-learn
On Thursday, 30 November 2017 at 22:52:33 UTC, Ali Çehreli wrote: On 11/30/2017 02:47 PM, A Guy With a Question wrote: This is probably a dumb question, but what I did looks ugly. Is there a way (preferably a one liner) to convert a single element, like an int or char or bool, into a range? i

Re: Convert a single element into a range

2017-11-30 Thread Ali Çehreli via Digitalmars-d-learn
On 11/30/2017 02:47 PM, A Guy With a Question wrote: This is probably a dumb question, but what I did looks ugly. Is there a way (preferably a one liner) to convert a single element, like an int or char or bool, into a range? import std.range; void main() { auto r = only(42); static a

Convert a single element into a range

2017-11-30 Thread A Guy With a Question via Digitalmars-d-learn
This is probably a dumb question, but what I did looks ugly. Is there a way (preferably a one liner) to convert a single element, like an int or char or bool, into a range?

Re: std.algorithm

2017-11-30 Thread Meta via Digitalmars-d-learn
On Thursday, 30 November 2017 at 20:49:36 UTC, flamencofantasy wrote: Hello, I have the following csv text; auto input = "Start Date,End Date,Subject,All day event,Categories,Show time as 1/1/2018,1/1/2018,New Year's Day,TRUE,Holiday,3 1/15/2018,1/15/2018,\"Martin Luther King, Jr. Day\",TRUE

std.algorithm

2017-11-30 Thread flamencofantasy via Digitalmars-d-learn
Hello, I have the following csv text; auto input = "Start Date,End Date,Subject,All day event,Categories,Show time as 1/1/2018,1/1/2018,New Year's Day,TRUE,Holiday,3 1/15/2018,1/15/2018,\"Martin Luther King, Jr. Day\",TRUE,Holiday,3 2/19/2018,2/19/2018,President's Day,TRUE,Holiday,3 5/28/2018,

Re: std.range.interfaces : InputRange moveFront

2017-11-30 Thread Ali Çehreli via Digitalmars-d-learn
On 11/30/2017 07:31 AM, Tony wrote: On Thursday, 30 November 2017 at 09:50:37 UTC, Tony wrote: On Thursday, 30 November 2017 at 09:47:14 UTC, Tony wrote: Thanks for the reply. Probably just missing it, but in poking around dlang.org (Language Reference and Library Reference) I am having troub

Re: Private imports and Objects

2017-11-30 Thread Patrick Schluter via Digitalmars-d-learn
On Thursday, 30 November 2017 at 06:44:43 UTC, Jonathan M Davis wrote: Object exists primarily because D didn't originally have templates, and when you don't have templates, having a single base class is the only way to have a function accept any class, and for something like a container, you'd

Re: Private imports and Objects

2017-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 30, 2017 10:54:44 helxi via Digitalmars-d-learn wrote: > On Thursday, 30 November 2017 at 06:44:43 UTC, Jonathan M Davis > > wrote: > > On Thursday, November 30, 2017 06:29:43 helxi via > > > Digitalmars-d-learn wrote: > [] > > > I don't understand the question. You're asking

Re: Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-11-30 12:19, Basile B. wrote: That's strange because as said i had g++ / c++ but DMD compiles only once gcc-c++ setup. Anyway, working now. It should be possible to get which package the "g++" file belongs to [1]. [1] https://unix.stackexchange.com/questions/4705/how-to-find-out-whic

Re: std.range.interfaces : InputRange moveFront

2017-11-30 Thread Tony via Digitalmars-d-learn
On Thursday, 30 November 2017 at 09:50:37 UTC, Tony wrote: On Thursday, 30 November 2017 at 09:47:14 UTC, Tony wrote: Thanks for the reply. Probably just missing it, but in poking around dlang.org (Language Reference and Library Reference) I am having trouble finding out about the move(), fron

Re: Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 30 November 2017 at 10:47:57 UTC, Jacob Carlborg wrote: On 2017-11-30 09:56, Basile B. wrote: On Thursday, 30 November 2017 at 08:38:15 UTC, Basile B. wrote: [...] All required tools are setup. I do not set AUTOBOOTSTRAP=1 since dmd 2.077 is setup. I needed gcc-c++... I don't kn

Re: Private imports and Objects

2017-11-30 Thread helxi via Digitalmars-d-learn
On Thursday, 30 November 2017 at 06:44:43 UTC, Jonathan M Davis wrote: On Thursday, November 30, 2017 06:29:43 helxi via Digitalmars-d-learn wrote: [] I don't understand the question. You're asking whether casting from a base class to a derived class creates overhead? Or are you asking whether

Re: Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-11-30 09:56, Basile B. wrote: On Thursday, 30 November 2017 at 08:38:15 UTC, Basile B. wrote: [...] All required tools are setup. I do not set AUTOBOOTSTRAP=1 since dmd 2.077 is setup. I needed gcc-c++... I don't know why but since "which g++" gave a valid file name i thought it was

Re: Shared and race conditions

2017-11-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-11-29 17:13, Wanderer wrote: I'm trying to simulate a race condition in D with the following code: I'm not sure what your end goal is but perhaps you could try to see if the LLVM thread sanitizer [1] can be used with LDC. The thread sanitizer can identify race conditions even though the

Re: Problems with ctRegex

2017-11-30 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 28 November 2017 at 19:12:29 UTC, crimaniak wrote: First problem: it doesn't understand enums, it seems to be a bug: or just "to!string(TopicMask.publishMask)" would have worked too. [...] Is there any change to use regex inside or pure function? I just need some pure bool test()

Re: std.range.interfaces : InputRange moveFront

2017-11-30 Thread Tony via Digitalmars-d-learn
On Thursday, 30 November 2017 at 09:47:14 UTC, Tony wrote: Thanks for the reply. Probably just missing it, but in poking around dlang.org (Language Reference and Library Reference) I am having trouble finding out about the move(), front() and moveFront() functions, as is used here on a dynamic

Re: std.range.interfaces : InputRange moveFront

2017-11-30 Thread Tony via Digitalmars-d-learn
On Thursday, 30 November 2017 at 06:36:12 UTC, Ali Çehreli wrote: move is an operation that transfers the state of the source to the destination. The front element becomes its .init value and its previous values is returned by moveFront(). The important bit is that, the element is *not* cop

Re: Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 30 November 2017 at 08:38:15 UTC, Basile B. wrote: [...] All required tools are setup. I do not set AUTOBOOTSTRAP=1 since dmd 2.077 is setup. I needed gcc-c++... I don't know why but since "which g++" gave a valid file name i thought it was enough. What's the difference ?

Instructions to build DMD from source don't work (anymore) here

2017-11-30 Thread Basile B. via Digitalmars-d-learn
Hi, I've recently switched from a linux distribution to another (F27). During the last 2 years i used a script to build DMD, unfortunately i forgot to include it in my backup. Initially i thought "No problem, there's the instructions in the wiki, it's more or less about calling make with a coup