Communicating with external processes in D

2015-11-23 Thread Cameron Reid via Digitalmars-d-learn
I'm rather new to D, so apologies if this is a silly question: I'd like to be able to fork a number of instances of a process, write to their stdins and read from their stdouts in parallel. That is, I want to write some data to the stdin of all these processes and collect lines written to

Re: Communicating with external processes in D

2015-11-23 Thread Quentin Ladeveze via Digitalmars-d-learn
On Monday, 23 November 2015 at 20:02:16 UTC, Cameron Reid wrote: I'm rather new to D, so apologies if this is a silly question: I'd like to be able to fork a number of instances of a process, write to their stdins and read from their stdouts in parallel. That is, I want to write some data to

Re: Communicating with external processes in D

2015-11-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 23 November 2015 at 20:02:16 UTC, Cameron Reid wrote: Is such a thing possible? If so, where might I go to educate myself? Yes, though the D stdlib doesn't help a whole lot, unless you want to use threads and that's blargh, I hate using threads and recommend you avoid them when

failing regex

2015-11-23 Thread yawniek via Digitalmars-d-learn
regex from https://github.com/ua-parser/uap-core/blob/master/regexes.yaml#L38 seems to work in other languages, not so in D: auto r2 = r"(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 _\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+))?)?".regex();

Re: regex format string problem

2015-11-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/11/15 9:22 PM, yawniek wrote: Hi Rikki, On Monday, 23 November 2015 at 03:57:06 UTC, Rikki Cattermole wrote: I take it that browscap[0] does it not do what you want? I have an generator at [1]. Feel free to steal. This looks interesting, thanks for the hint. However it might be a bit

Re: failing regex

2015-11-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/11/15 9:30 PM, yawniek wrote: regex from https://github.com/ua-parser/uap-core/blob/master/regexes.yaml#L38 seems to work in other languages, not so in D: auto r2 = r"(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 _\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*))

Re: regex format string problem

2015-11-23 Thread yawniek via Digitalmars-d-learn
Hi Rikki, On Monday, 23 November 2015 at 03:57:06 UTC, Rikki Cattermole wrote: I take it that browscap[0] does it not do what you want? I have an generator at [1]. Feel free to steal. This looks interesting, thanks for the hint. However it might be a bit limited, i have 15M+ different User

Re: copy and array length vs capacity. (Doc suggestion?)

2015-11-23 Thread Jon D via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 01:00:40 UTC, Steven Schveighoffer wrote: On 11/23/15 7:29 PM, Ali Çehreli wrote: On 11/23/2015 04:03 PM, Steven Schveighoffer wrote: > On 11/23/15 4:29 PM, Jon D wrote: >> In the example I gave, what I was really wondering was if there is a >> difference

Finding packages recursively

2015-11-23 Thread BLM768 via Digitalmars-d-learn
I'm trying to recursively visit a package and all packages/modules within it using metaprogramming. I should be able to use __traits(allMembers, somePackage) recursively to get all symbols within the package, but is there an easy way to determine whether a symbol represents a package, a

Re: copy and array length vs capacity. (Doc suggestion?)

2015-11-23 Thread Ali Çehreli via Digitalmars-d-learn
On 11/23/2015 04:03 PM, Steven Schveighoffer wrote: > On 11/23/15 4:29 PM, Jon D wrote: >> In the example I gave, what I was really wondering was if there is a >> difference between allocating with 'new' or with 'reserve', or with >> 'length', for that matter. That is, is there a material

Re: copy and array length vs capacity. (Doc suggestion?)

2015-11-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/23/15 4:29 PM, Jon D wrote: On Monday, 23 November 2015 at 15:19:08 UTC, Steven Schveighoffer wrote: On 11/21/15 10:19 PM, Jon D wrote: On Sunday, 22 November 2015 at 00:31:53 UTC, Jonathan M Davis wrote: Honestly, arrays suck as output ranges. They don't get appended to; they get

Re: copy and array length vs capacity. (Doc suggestion?)

2015-11-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/23/15 7:29 PM, Ali Çehreli wrote: On 11/23/2015 04:03 PM, Steven Schveighoffer wrote: > On 11/23/15 4:29 PM, Jon D wrote: >> In the example I gave, what I was really wondering was if there is a >> difference between allocating with 'new' or with 'reserve', or with >> 'length', for

AA behaves differently in CTFE?

2015-11-23 Thread Bastiaan Veelo via Digitalmars-d-learn
Pegged uses an associative array to prevent infinite recursion [1]. This fails on some input, but only when used in CTFE [2]. The reduced case follows. I presume this is a bug? [1] https://github.com/PhilippeSigaud/Pegged/blob/master/pegged/dev/introspection.d#L281 [2]

Re: Building the Docs with checked out code downoads old dmd

2015-11-23 Thread bachmeier via Digitalmars-d-learn
On Saturday, 21 November 2015 at 21:04:26 UTC, H. S. Teoh wrote: To prevent downloading / building old versions of dmd, when running make in the dlang.org repo, specify the 'html' target: make -f posix.mak html This will also skip the Kindle builds and various other things that may

Re: copy and array length vs capacity. (Doc suggestion?)

2015-11-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/21/15 10:19 PM, Jon D wrote: On Sunday, 22 November 2015 at 00:31:53 UTC, Jonathan M Davis wrote: Honestly, arrays suck as output ranges. They don't get appended to; they get filled, and for better or worse, the documentation for copy is probably assuming that you know that. If you want

Re: Case-insensitive BoyerMooreFinder

2015-11-23 Thread Ali Çehreli via Digitalmars-d-learn
On 11/21/2015 08:50 AM, Ralf wrote: The problem is here: https://github.com/D-Programming-Language/phobos/blob/v2.069.1/std/algorithm/searching.d#L280 When it looks letters up in its private lookup tables, it uses the original letters, not the lower case ones. To work around this, I copied

Re: copy and array length vs capacity. (Doc suggestion?)

2015-11-23 Thread Jon D via Digitalmars-d-learn
On Monday, 23 November 2015 at 15:19:08 UTC, Steven Schveighoffer wrote: On 11/21/15 10:19 PM, Jon D wrote: On Sunday, 22 November 2015 at 00:31:53 UTC, Jonathan M Davis wrote: Honestly, arrays suck as output ranges. They don't get appended to; they get filled, and for better or worse, the