digitalmars.D.learn - Regression?
- Sebastiaan Koppe (15/15) Sep 06 2015 This used to work in older compiler (might have been v2.067 or
- Sebastiaan Koppe (1/1) Sep 06 2015 Dammit, i am on windows, DMD32 D Compiler v2.068.0
- Sebastiaan Koppe (7/7) Sep 07 2015 Fixed it by changing into:
- FreeSlave (7/14) Sep 08 2015 Why would you read file by line and then merge all into one
- Jonathan M Davis via Digitalmars-d-learn (4/19) Sep 08 2015 Or just use std.file.readText:
- Sebastiaan Koppe (9/24) Sep 08 2015 Thanks for your advice. But that is not what I asked for.
- Jack Stouffer (3/11) Dec 08 2015 I just ran into this as well. This seems like a regression.
- Jack Stouffer (3/11) Dec 08 2015 https://issues.dlang.org/show_bug.cgi?id=15423
This used to work in older compiler (might have been v2.067 or v2.066, not older). ``` import std.stdio; import std.json; import std.algorithm; void main() { auto ls = File("../languages.json","r").byLineCopy().joiner.parseJSON(); } ``` Error: c:\D\dmd2\windows\bin\..\..\src\phobos\std\json.d(639): Error: variable std.json.parseJSON!(Result).parseJSON.json has scoped destruction, cannot build closure
Sep 06 2015
Dammit, i am on windows, DMD32 D Compiler v2.068.0
Sep 06 2015
Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.parseJSON(); ```
Sep 07 2015
On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe wrote:Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.parseJSON(); ```Why would you read file by line and then merge all into one string? You end up with reading the whole file (well, getting rid of line ends) anyway, so probably the more efficient solution would be just read the whole file at once with std.file.read and cast to string.
Sep 08 2015
On Tuesday, September 08, 2015 07:12:50 FreeSlave via Digitalmars-d-learn wrote:On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe wrote:Or just use std.file.readText: http://dlang.org/phobos/std_file.html#readText - Jonathan M DavisFixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.parseJSON(); ```Why would you read file by line and then merge all into one string? You end up with reading the whole file (well, getting rid of line ends) anyway, so probably the more efficient solution would be just read the whole file at once with std.file.read and cast to string.
Sep 08 2015
On Tuesday, 8 September 2015 at 07:12:52 UTC, FreeSlave wrote:On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe wrote:Thanks for your advice. But that is not what I asked for. The question was, why doesn't this work anymore with the latest (2.068.0 and 2.068.1) compiler: ``` auto ls = File("../languages.json","r").byLineCopy().joiner.parseJSON(); ``` It should. Right?Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.parseJSON(); ```Why would you read file by line and then merge all into one string? You end up with reading the whole file (well, getting rid of line ends) anyway, so probably the more efficient solution would be just read the whole file at once with std.file.read and cast to string.
Sep 08 2015
On Wednesday, 9 September 2015 at 01:35:26 UTC, Sebastiaan Koppe wrote:Thanks for your advice. But that is not what I asked for. The question was, why doesn't this work anymore with the latest (2.068.0 and 2.068.1) compiler: ``` auto ls = File("../languages.json","r").byLineCopy().joiner.parseJSON(); ``` It should. Right?I just ran into this as well. This seems like a regression.
Dec 08 2015
On Wednesday, 9 September 2015 at 01:35:26 UTC, Sebastiaan Koppe wrote:Thanks for your advice. But that is not what I asked for. The question was, why doesn't this work anymore with the latest (2.068.0 and 2.068.1) compiler: ``` auto ls = File("../languages.json","r").byLineCopy().joiner.parseJSON(); ``` It should. Right?https://issues.dlang.org/show_bug.cgi?id=15423
Dec 08 2015