Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread bauss via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:57:07 UTC, Basile B. wrote: On Monday, 21 February 2022 at 10:53:56 UTC, Basile B. wrote: On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching St

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread partypooper via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:21:52 UTC, Mike Parker wrote: On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote: [...] This has nothing to do with which exceptions types a function throws. The compiler doesn't dig into that. You have to catch `Exception`. ```D import std.stdio

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:12:38 UTC, partypooper wrote: On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote: Yeah there must be another one then. Something actionnable is the documentation. What about Mike Parker answer? if nothrow fails that's because things are checked. We

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote: Yeah there must be another one then. Something actionnable is the documentation. This has nothing to do with which exceptions types a function throws. The compiler doesn't dig into that. You have to catch `Exception`. ```D impo

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:11:28 UTC, partypooper wrote: So with such behavior there is no reason at all to make make function nothrow, if it uses throw functions in its body? I'm not sure what you mean. If a function throws an exception, it can't be nothrow. And as much as I already

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread partypooper via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:07:55 UTC, Basile B. wrote: Yeah there must be another one then. Something actionnable is the documentation. What about Mike Parker answer?

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread partypooper via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:04:46 UTC, Mike Parker wrote: On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? D does not have checked exceptions like Java,

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 February 2022 at 11:05:42 UTC, partypooper wrote: On Monday, 21 February 2022 at 10:58:26 UTC, Basile B. wrote: more likely UTFException actually Additionaly catching UTF and Conv exceptions doesn't help. Yeah there must be another one then. Something actionnable is the docume

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread partypooper via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:58:26 UTC, Basile B. wrote: more likely UTFException actually Additionaly catching UTF and Conv exceptions doesn't help.

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? D does not have checked exceptions like Java, so the compiler doesn't have anyway to verify that any function

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? This doesn't work ```d nothrow void hello() { try { writeln("Hello, World!") } catch (StdioException)

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:53:56 UTC, Basile B. wrote: On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? This doesn't work ```d nothrow void hello() {

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:53:56 UTC, Basile B. wrote: On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? This doesn't work ```d nothrow void hello() {

Re: Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread Basile B. via Digitalmars-d-learn
On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote: Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? This doesn't work ```d nothrow void hello() { try { writeln("Hello, World!") } catch (StdioException)

Why writeln can't be converted to nothrow with just catching of StdioException

2022-02-21 Thread partypooper via Digitalmars-d-learn
Do I completely not understand what is `nothrow` or why I can't make function nothrow with just catching StdioException? This doesn't work ```d nothrow void hello() { try { writeln("Hello, World!") } catch (StdioException) {} } ``` This doest work ```d nothrow void hello() { try {