Re: Reading text (I mean "real" text...)

2020-06-19 Thread Denis via Digitalmars-d-learn
On Saturday, 20 June 2020 at 01:41:50 UTC, Paul Backus wrote: It sounds like maybe what you are looking for is Unicode character categories: https://en.wikipedia.org/wiki/Unicode_character_property#General_Category The character validation step could indeed be expressed using Unicode

Re: Reading text (I mean "real" text...)

2020-06-19 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 20 June 2020 at 01:35:56 UTC, Denis wrote: THE OBJECTIVE The objective is to read a file one line at a time (reading each line into a string), while checking for human-readable text character by character. Invalid characters (control and UTF-8) should generate an exception.

Reading text (I mean "real" text...)

2020-06-19 Thread Denis via Digitalmars-d-learn
THE PROBLEM UTF-8 validation alone is insufficient for ensuring that a file contains only human-readable text, because control characters are UTF-8 valid. Apart from tab, newline, carriage return, and a few less commonly used others considered to be whitespace, human-readable text files

Re: Arduino and MCU Support

2020-06-19 Thread aberba via Digitalmars-d-learn
On Friday, 19 June 2020 at 11:57:01 UTC, frasdoge wrote: I am looking to use D for microcontroller programming due to its benefits over C in workflow and general language features. I was wondering what the current state of this is, especially with regards to AVR. An example of the MCUs I

Re: Should the compiler be failing to infer template args here?

2020-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/19/20 12:38 PM, SealabJaster wrote: On Friday, 19 June 2020 at 16:31:50 UTC, Paul Backus wrote: This is a known issue: https://issues.dlang.org/show_bug.cgi?id=1807 "Reported: 2008"... yikes. Thanks anyway, glad to know I wasn't just going mad :) It's somewhat difficult to solve,

Re: Should the compiler be failing to infer template args here?

2020-06-19 Thread SealabJaster via Digitalmars-d-learn
On Friday, 19 June 2020 at 16:31:50 UTC, Paul Backus wrote: This is a known issue: https://issues.dlang.org/show_bug.cgi?id=1807 "Reported: 2008"... yikes. Thanks anyway, glad to know I wasn't just going mad :)

Re: Should the compiler be failing to infer template args here?

2020-06-19 Thread Paul Backus via Digitalmars-d-learn
On Friday, 19 June 2020 at 16:16:55 UTC, SealabJaster wrote: If you take a look at this code here: https://godbolt.org/z/4T3uLh You can see that when using a templated alias, the compiler fails to infer the T template parameter, but only when using the function that also asks for the alias,

Should the compiler be failing to infer template args here?

2020-06-19 Thread SealabJaster via Digitalmars-d-learn
If you take a look at this code here: https://godbolt.org/z/4T3uLh You can see that when using a templated alias, the compiler fails to infer the T template parameter, but only when using the function that also asks for the alias, instead of the original type. I was just wondering if this

Re: Parallel array append using std.parallelism?

2020-06-19 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jun 19, 2020 at 06:48:18AM +, Simen Kjærås via Digitalmars-d-learn wrote: [...] > There's an example of exactly this in std.parallelism: > https://dlang.org/phobos/std_parallelism.html#.TaskPool.workerIndex > > In short: > > Item[] targetArray = ...; // already contains data >

Re: Arduino and MCU Support

2020-06-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 June 2020 at 14:14:07 UTC, frasdoge wrote: though the -mcpu does not have any AVR options out-of-the-box as you mentioned. I guess you mean `ldc2 -mcpu=help` doesn't list any AVR CPUs. Use `ldc2 -mtriple=avr -mcpu=help`.

Re: Arduino and MCU Support

2020-06-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 June 2020 at 14:14:07 UTC, frasdoge wrote: I'm having a bit of trouble understanding how to actually get started even with those links. I've installed the latest LDC and LLVM releases for Windows, though the -mcpu does not have any AVR options out-of-the-box as you mentioned.

Re: Arduino and MCU Support

2020-06-19 Thread frasdoge via Digitalmars-d-learn
On Friday, 19 June 2020 at 12:20:52 UTC, kinke wrote: AVR: https://wiki.dlang.org/D_on_AVR With recent official LDC packages, you don't need to build LLVM and LDC yourself, AVR is supported out-of-the-box. ESP32:

Re: Why is there no std.stream anymore?

2020-06-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/18/20 11:11 PM, Jesse Phillips wrote: On Thursday, 18 June 2020 at 14:53:58 UTC, aberba wrote: On Tuesday, 12 December 2017 at 20:51:30 UTC, Steven Schveighoffer wrote: On 12/11/17 6:33 PM, Seb wrote: [...] Since iopipe was mentioned several times, I will say a couple things: [...]

Re: Arduino and MCU Support

2020-06-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 June 2020 at 11:57:01 UTC, frasdoge wrote: I am looking to use D for microcontroller programming due to its benefits over C in workflow and general language features. I was wondering what the current state of this is, especially with regards to AVR. An example of the MCUs I

Arduino and MCU Support

2020-06-19 Thread frasdoge via Digitalmars-d-learn
I am looking to use D for microcontroller programming due to its benefits over C in workflow and general language features. I was wondering what the current state of this is, especially with regards to AVR. An example of the MCUs I would like to develop with include anything from 8 bit

Re: "if not" condition check (for data validation)

2020-06-19 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 18 June 2020 at 17:39:44 UTC, Denis wrote: I should add that this one made me laugh though, giving flashbacks to that horrible "not speak" of the early 90s: if ( configfile.isFile.not ) ... LOL Approve Yoda does.

Re: Parallel array append using std.parallelism?

2020-06-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 18 June 2020 at 14:43:54 UTC, H. S. Teoh wrote: I have an array of input data that I'm looping over, and, based on some condition, generate new items that are appended onto a target array (which may already contain data). Since the creation of new items is quite expensive, I'm