Re: File .. byLine

2018-12-02 Thread Joel via Digitalmars-d-learn
On Monday, 3 December 2018 at 06:55:50 UTC, Nicholas Wilson wrote: On Monday, 3 December 2018 at 06:09:21 UTC, Joel wrote: [...] https://run.dlang.io/is/h0ArAB works for me. If you want it as a string not char[] then byLineCopy should work, if not just `.idup` `line`. Oh, I was using std.

Re: File .. byLine

2018-12-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 3 December 2018 at 06:09:21 UTC, Joel wrote: I can't seem to get this to work! ``` foreach(line; File("help.txt").byLine) { writeln(line.stripLeft); ``` With the code above, I get this compile error: source/app.d(360,36): Error: template std.algorithm.mutation.stripLeft cannot d

File .. byLine

2018-12-02 Thread Joel via Digitalmars-d-learn
I can't seem to get this to work! ``` foreach(line; File("help.txt").byLine) { writeln(line.stripLeft); ``` With the code above, I get this compile error: source/app.d(360,36): Error: template std.algorithm.mutation.stripLeft cannot deduce function from argument types !()(char[]), candidat

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-12-02 Thread Tony via Digitalmars-d-learn
On Saturday, 1 December 2018 at 19:02:54 UTC, H. S. Teoh wrote: But that's precisely the problem. It's not always possible to tell whether a variable has been initialized. E.g.: To me, the possibility of a "false positive" doesn't preclude the use of a warning unless that possibility is lar

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-12-02 Thread aliak via Digitalmars-d-learn
On Saturday, 1 December 2018 at 19:02:54 UTC, H. S. Teoh wrote: In the above contrived example, Artin's conjecture is implied by the Riemann hypothesis, so the second if statement would only run if p is initialized. But there is no way the compiler is going to be able to deduce this, especial

Re: compile time sequence through dub config or commandline.

2018-12-02 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Sunday, 2 December 2018 at 17:59:56 UTC, Paul Backus wrote: The normal way to do this would be to make bar a template and have the program that uses it pass these parameters to it as template arguments. Why didn't I think of that? It's just initializing a library, of course! Thank you for y

Re: compile time sequence through dub config or commandline.

2018-12-02 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 2 December 2018 at 14:50:05 UTC, Sjoerd Nijboer wrote: The idea being that bar can be packed in a library and the program that includes this library can decide what parameters will be added to foo whitout any runtime overhead and ugly looking syntax. The normal way to do this would

compile time sequence through dub config or commandline.

2018-12-02 Thread Sjoerd Nijboer via Digitalmars-d-learn
I would like to do something like ` dmd --buildversion=fooCollection{"a", "b", "c"} -run app.d ... void bar() { static foreach(i; fooCollection) { ... } } ` The idea being that bar can be packed in a library and the program that includes this library can decide what paramet

Re: Nested sub packages in dub

2018-12-02 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 2 December 2018 at 09:17:59 UTC, Domain wrote: How to do that? As far as I know dub does not support nested sub packages. You could create a second dub package B with sub package B1 and reference it from your sub package A1. Kind regards Andre

Nested sub packages in dub

2018-12-02 Thread Domain via Digitalmars-d-learn
How to do that?