Re: std_exception.html#enforce: example does not compile

2018-01-28 Thread Seb via Digitalmars-d-learn
On Saturday, 27 January 2018 at 21:27:44 UTC, kdevel wrote: On Saturday, 27 January 2018 at 20:33:46 UTC, Jonathan M Davis wrote: Shall I file a bug report? Yes. https://issues.dlang.org/show_bug.cgi?id=18319 Thanks. Addressed and already merged: https://github.com/dlang/phobos/pull/6080

Re: std_exception.html#enforce: example does not compile

2018-01-27 Thread kdevel via Digitalmars-d-learn
On Saturday, 27 January 2018 at 20:33:46 UTC, Jonathan M Davis wrote: Shall I file a bug report? Yes. https://issues.dlang.org/show_bug.cgi?id=18319

Re: std_exception.html#enforce: example does not compile

2018-01-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, January 27, 2018 20:11:29 kdevel via Digitalmars-d-learn wrote: > On Saturday, 27 January 2018 at 18:34:35 UTC, Jonathan M Davis > > wrote: > >> The example still does not compile. > > > > That has nothing to do with enforce. std.stdio.readln does not > > take a FILE*. In general, you

Re: std_exception.html#enforce: example does not compile

2018-01-27 Thread kdevel via Digitalmars-d-learn
On Saturday, 27 January 2018 at 18:34:35 UTC, Jonathan M Davis wrote: The example still does not compile. That has nothing to do with enforce. std.stdio.readln does not take a FILE*. In general, you shouldn't mix core.stdc.stdio and std.stdio. The code is from the official documentation: -

Re: std_exception.html#enforce: example does not compile

2018-01-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, January 27, 2018 17:57:54 kdevel via Digitalmars-d-learn wrote: > On Saturday, 27 January 2018 at 16:10:29 UTC, Jonathan M Davis > > wrote: > > On Saturday, January 27, 2018 13:29:00 kdevel via > > > > Digitalmars-d-learn wrote: > >> What's wrong here? And why is the "selective import"

Re: std_exception.html#enforce: example does not compile

2018-01-27 Thread kdevel via Digitalmars-d-learn
On Saturday, 27 January 2018 at 16:10:29 UTC, Jonathan M Davis wrote: On Saturday, January 27, 2018 13:29:00 kdevel via Digitalmars-d-learn wrote: What's wrong here? And why is the "selective import" of enforce necessary? Because you named your module enforce. As such, by default, referring t

Re: std_exception.html#enforce: example does not compile

2018-01-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, January 27, 2018 13:29:00 kdevel via Digitalmars-d-learn wrote: > What's wrong here? And why is the "selective import" of enforce > necessary? Because you named your module enforce. As such, by default, referring to enforce inside of the module refers to the module. Having the selecti

std_exception.html#enforce: example does not compile

2018-01-27 Thread kdevel via Digitalmars-d-learn
https://dlang.org/phobos/std_exception.html#enforce and also https://dlang.org/library/std/exception/enforce.html present this example: --- auto f = enforce(fopen("data.txt")); auto line = readln(f); enforce(line.length, "Expected a non-empty line."); --- fopen, readln and enforce need imports