Re: What is the point of nothrow?

2018-06-23 Thread wjoe via Digitalmars-d-learn
On Thursday, 21 June 2018 at 19:52:25 UTC, Jonathan M Davis wrote: On Thursday, June 21, 2018 13:16:28 wjoe via Digitalmars-d-learn wrote: On Wednesday, 20 June 2018 at 12:22:33 UTC, Kagamin wrote: > Do you know how to extract information from it on an > unfamiliar OS? Reading stack trace is

Re: What is the point of nothrow?

2018-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 21, 2018 13:16:28 wjoe via Digitalmars-d-learn wrote: > On Wednesday, 20 June 2018 at 12:22:33 UTC, Kagamin wrote: > > Do you know how to extract information from it on an unfamiliar > > OS? Reading stack trace is easier and self-evident. > > Counter question: How do you develop

Re: What is the point of nothrow?

2018-06-21 Thread wjoe via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 12:22:33 UTC, Kagamin wrote: On Tuesday, 19 June 2018 at 15:03:49 UTC, wjoe wrote: But maybe I missed something else and the only purpose of D is to make console applications for *NIX like OSs and expect users to be professional enough to save that stack trace

Re: What is the point of nothrow?

2018-06-20 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 19 June 2018 at 15:03:49 UTC, wjoe wrote: But maybe I missed something else and the only purpose of D is to make console applications for *NIX like OSs and expect users to be professional enough to save that stack trace before they close the terminal ? I just read stack trace

Re: What is the point of nothrow?

2018-06-19 Thread wjoe via Digitalmars-d-learn
On Tuesday, 19 June 2018 at 12:26:15 UTC, Kagamin wrote: On Friday, 15 June 2018 at 17:46:02 UTC, wjoe wrote: D allows various levels of performance and safety. Though I'd say Errors not working in debug mode is not intended, the Intention matters not. By definition all program state is

Re: What is the point of nothrow?

2018-06-19 Thread Kagamin via Digitalmars-d-learn
On Friday, 15 June 2018 at 17:46:02 UTC, wjoe wrote: D allows various levels of performance and safety. Though I'd say Errors not working in debug mode is not intended, the Intention matters not. By definition all program state is invalid at the point an Error was thrown. From there on it is

Re: What is the point of nothrow?

2018-06-19 Thread wjoe via Digitalmars-d-learn
On Monday, 18 June 2018 at 20:23:48 UTC, Jonathan M Davis wrote: On Monday, June 18, 2018 15:22:48 wjoe via Digitalmars-d-learn wrote: On Saturday, 16 June 2018 at 21:25:01 UTC, Jonathan M Davis wrote: > every feature that you can't use in betterC is considered a > loss, and efforts are being

Re: What is the point of nothrow?

2018-06-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 18, 2018 15:22:48 wjoe via Digitalmars-d-learn wrote: > On Saturday, 16 June 2018 at 21:25:01 UTC, Jonathan M Davis wrote: > > every feature that you can't use in betterC is considered a > > loss, and efforts are being made to make more of them work. > > There's always going to be

Re: What is the point of nothrow?

2018-06-18 Thread wjoe via Digitalmars-d-learn
On Saturday, 16 June 2018 at 21:25:01 UTC, Jonathan M Davis wrote: On Saturday, June 16, 2018 18:45:53 wjoe via Digitalmars-d-learn wrote: What you said earlier: On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > [...] > > 2. If the compiler knows that a function can't throw

Re: What is the point of nothrow?

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 18:45:53 wjoe via Digitalmars-d-learn wrote: > What you said earlier: > > On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > > [...] > > > > 2. If the compiler knows that a function can't throw an > > Exception, then it doesn't have to insert any of the

Re: What is the point of nothrow?

2018-06-16 Thread wjoe via Digitalmars-d-learn
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: On Thursday, June 14, 2018 18:11:20 wjoe via Digitalmars-d-learn wrote: On Wednesday, 13 June 2018 at 20:08:06 UTC, Jonathan M Davis wrote: > On Wednesday, June 13, 2018 10:56:41 wjoe via > The idea is that because your program

Re: What is the point of nothrow?

2018-06-15 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 June 2018 at 17:29:39 UTC, bauss wrote: [snip] There is a reason that I have not gotten rid of this: http://diamondmvc.org/docs/logging/#database-logging It just _works_ most of the time and really helpful when you do not have access to the server and/or the standard

Re: What is the point of nothrow?

2018-06-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/15/18 1:27 PM, bauss wrote: On Friday, 15 June 2018 at 17:25:18 UTC, wjoe wrote: On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote: On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: So in case of a thrown Error, you can catch it and log it to a database. No, you

Re: What is the point of nothrow?

2018-06-15 Thread wjoe via Digitalmars-d-learn
On Friday, 15 June 2018 at 17:27:13 UTC, bauss wrote: On Friday, 15 June 2018 at 17:25:18 UTC, wjoe wrote: On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote: On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: So in case of a thrown Error, you can catch it and log it to a

Re: What is the point of nothrow?

2018-06-15 Thread wjoe via Digitalmars-d-learn
On Friday, 15 June 2018 at 08:13:44 UTC, Kagamin wrote: On Wednesday, 13 June 2018 at 17:08:26 UTC, wjoe wrote: My question was more like what's the benefit of having thrown Errors corrupt your program state rendering it useless for debugging ? D allows various levels of performance and

Re: What is the point of nothrow?

2018-06-15 Thread bauss via Digitalmars-d-learn
On Friday, 15 June 2018 at 17:25:18 UTC, wjoe wrote: On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote: On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: So in case of a thrown Error, you can catch it and log it to a database. No, you can't. Once the Error was thrown

Re: What is the point of nothrow?

2018-06-15 Thread bauss via Digitalmars-d-learn
On Friday, 15 June 2018 at 17:27:13 UTC, bauss wrote: On Friday, 15 June 2018 at 17:25:18 UTC, wjoe wrote: On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote: On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: So in case of a thrown Error, you can catch it and log it to a

Re: What is the point of nothrow?

2018-06-15 Thread wjoe via Digitalmars-d-learn
On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote: On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: So in case of a thrown Error, you can catch it and log it to a database. No, you can't. Once the Error was thrown the program is in invalid state and you can't assume

Re: What is the point of nothrow?

2018-06-15 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 17:08:26 UTC, wjoe wrote: My question was more like what's the benefit of having thrown Errors corrupt your program state rendering it useless for debugging ? D allows various levels of performance and safety. Though I'd say Errors not working in debug mode is

Re: What is the point of nothrow?

2018-06-14 Thread bauss via Digitalmars-d-learn
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote: As I said, personally, I think that the program shut just print and terminate rather than throwing an Error. Walter seems to It makes perfectly sense for it to throw an error and not just print and terminate. This is

Re: What is the point of nothrow?

2018-06-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 14, 2018 18:11:20 wjoe via Digitalmars-d-learn wrote: > On Wednesday, 13 June 2018 at 20:08:06 UTC, Jonathan M Davis > wrote: > > On Wednesday, June 13, 2018 10:56:41 wjoe via > > The idea is that because your program is in an invalid state, > > attempting a graceful shutdown is

Re: What is the point of nothrow?

2018-06-14 Thread wjoe via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 20:08:06 UTC, Jonathan M Davis wrote: On Wednesday, June 13, 2018 10:56:41 wjoe via Digitalmars-d-learn wrote: On Wednesday, 13 June 2018 at 03:14:33 UTC, Jonathan M Davis > regardless of whether the decision to treat failed memory > allocations as an Error was a

Re: What is the point of nothrow?

2018-06-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 13, 2018 10:56:41 wjoe via Digitalmars-d-learn wrote: > On Wednesday, 13 June 2018 at 03:14:33 UTC, Jonathan M Davis > > wrote: > > Most programs do not handle the case where they run out of > > memory and cannot continue at that point. For better or worse, > > D's GC was

Re: What is the point of nothrow?

2018-06-13 Thread wjoe via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 13:05:44 UTC, Kagamin wrote: On Wednesday, 13 June 2018 at 10:56:41 UTC, wjoe wrote: I understand the idea that an Error is not supposed to be caught but why would such a 'feature' be desirable? Where's the benefit if nothing can be relied upon ? It's a

Re: What is the point of nothrow?

2018-06-13 Thread wjoe via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 12:59:27 UTC, Kagamin wrote: On Wednesday, 13 June 2018 at 02:02:54 UTC, wjoe wrote: it is possible to install a signal handler for almost every signal on POSIX, including segfault. The only signal you can't catch is signal 9 - sigkill if memory serves. So I could

Re: What is the point of nothrow?

2018-06-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/13/18 8:44 AM, Kagamin wrote: On Tuesday, 12 June 2018 at 14:15:42 UTC, Steven Schveighoffer wrote: I predict at some point when Errors actually don't do proper cleanup, it is going to be a really difficult time for D. Looks like it already doesn't: https://run.dlang.io/is/OhDwtW Damn,

Re: What is the point of nothrow?

2018-06-13 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 10:56:41 UTC, wjoe wrote: I understand the idea that an Error is not supposed to be caught but why would such a 'feature' be desirable? Where's the benefit if nothing can be relied upon ? It's a debugging facility for development stage that allows to print the

Re: What is the point of nothrow?

2018-06-13 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 02:02:54 UTC, wjoe wrote: it is possible to install a signal handler for almost every signal on POSIX, including segfault. The only signal you can't catch is signal 9 - sigkill if memory serves. So I could for instance install a clean up handler on a segfault via

Re: What is the point of nothrow?

2018-06-13 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 14:15:42 UTC, Steven Schveighoffer wrote: I predict at some point when Errors actually don't do proper cleanup, it is going to be a really difficult time for D. Looks like it already doesn't: https://run.dlang.io/is/OhDwtW

Re: What is the point of nothrow?

2018-06-13 Thread wjoe via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 03:14:33 UTC, Jonathan M Davis wrote: Most programs do not handle the case where they run out of memory and cannot continue at that point. For better or worse, D's GC was designed with that in mind, and it treats failed allocations as an Error. In the vast

Re: What is the point of nothrow?

2018-06-12 Thread Neia Neutuladh via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 00:38:55 UTC, Jonathan M Davis wrote: It's possible to write programs that check and handle running out of memory, but most programs don't, and usually, if a program runs out of memory, it can't do anything about it and can't function properly at that point.

Re: What is the point of nothrow?

2018-06-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 13, 2018 02:02:54 wjoe via Digitalmars-d-learn wrote: > On Tuesday, 12 June 2018 at 18:41:07 UTC, Jonathan M Davis wrote: > > On Tuesday, June 12, 2018 17:38:07 wjoe via Digitalmars-d-learn > > > > wrote: > >> On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis > >> > >>

Re: What is the point of nothrow?

2018-06-12 Thread wjoe via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 18:41:07 UTC, Jonathan M Davis wrote: On Tuesday, June 12, 2018 17:38:07 wjoe via Digitalmars-d-learn wrote: On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > On Sunday, June 10, 2018 23:59:17 Bauss via > Digitalmars-d-learn > wrote: > Errors are

Re: What is the point of nothrow?

2018-06-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 12, 2018 23:32:55 Neia Neutuladh via Digitalmars-d-learn wrote: > On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > > Why do you care about detecting code that can throw an Error? > > Errors are supposed to kill the program, not get caught. As > > such, why does

Re: What is the point of nothrow?

2018-06-12 Thread Neia Neutuladh via Digitalmars-d-learn
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: Why do you care about detecting code that can throw an Error? Errors are supposed to kill the program, not get caught. As such, why does it matter if it can throw an Error? Error is currently used for three different things: *

Re: What is the point of nothrow?

2018-06-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 12, 2018 17:38:07 wjoe via Digitalmars-d-learn wrote: > On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > > On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn > > wrote: > > Errors are supposed to kill the program, not get caught. As > > such, why

Re: What is the point of nothrow?

2018-06-12 Thread wjoe via Digitalmars-d-learn
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: Errors are supposed to kill the program, not get caught. As such, why does it matter if it can throw an Error? Now, personally, I'm increasingly of the

Re: What is the point of nothrow?

2018-06-12 Thread wjoe via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 15:48:58 UTC, Bauss wrote: Ex. int a = array[400]; Could yield a warning stating a possible a out of bounds error. Where: int a = array.length >= 401 ? array[400] : 0; looks to me like a crash guard. Similar to something like this void fn(Foo* foo) { if

Re: What is the point of nothrow?

2018-06-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/12/18 11:48 AM, Bauss wrote: On Tuesday, 12 June 2018 at 14:19:42 UTC, Steven Schveighoffer wrote: On 6/10/18 7:59 PM, Bauss wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because

Re: What is the point of nothrow?

2018-06-12 Thread Bauss via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 14:19:42 UTC, Steven Schveighoffer wrote: On 6/10/18 7:59 PM, Bauss wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you can't really use

Re: What is the point of nothrow?

2018-06-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/10/18 7:59 PM, Bauss wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you can't really use it as protection to write bugless, safe code since the nasty bugs will pass by just

Re: What is the point of nothrow?

2018-06-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/11/18 5:23 PM, Jonathan M Davis wrote: On Monday, June 11, 2018 20:45:52 Dave Jones via Digitalmars-d-learn wrote: So the only solution I could figure is to catch throwable in the callback function, dump the message, and then PostQuitMessage(0). It just seems retarded that Throwables can

Re: What is the point of nothrow?

2018-06-12 Thread Kagamin via Digitalmars-d-learn
On Sunday, 10 June 2018 at 23:59:17 UTC, Bauss wrote: To me it would be so much more useful if you could detect code that could possibly throw Error. Such things are usually done by formal verification systems like F*, and I suppose Ada 2012 has it to some extent too. Though I suspect it's

Re: What is the point of nothrow?

2018-06-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 11, 2018 20:45:52 Dave Jones via Digitalmars-d-learn wrote: > On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: > > On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn > > > > wrote: > >> What is the point of noth

Re: What is the point of nothrow?

2018-06-11 Thread Dave Jones via Digitalmars-d-learn
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you

Re: What is the point of nothrow?

2018-06-11 Thread Meta via Digitalmars-d-learn
On Monday, 11 June 2018 at 04:11:38 UTC, Bauss wrote: On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown

Re: What is the point of nothrow?

2018-06-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 11, 2018 04:11:38 Bauss via Digitalmars-d-learn wrote: > I'm very well aware that Error is not supposed to be caught and > that the program is in an invalid state, but ehat I'm trying to > get at is that if nothrow or at least a feature similar existed > that could detect code that

Re: What is the point of nothrow?

2018-06-10 Thread Bauss via Digitalmars-d-learn
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you

Re: What is the point of nothrow?

2018-06-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: > What is the point of nothrow if it can only detect when Exception > is thrown and not when Error is thrown? > > It seems like the attribute is useless because you can't really > use it as protection to writ

What is the point of nothrow?

2018-06-10 Thread Bauss via Digitalmars-d-learn
What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you can't really use it as protection to write bugless, safe code since the nasty bugs will pass by just fine. I'm aware that it's