Re: Comparing Exceptions and Errors

2022-06-04 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 4 June 2022 at 22:03:08 UTC, kdevel wrote: On Saturday, 4 June 2022 at 14:05:14 UTC, Paul Backus wrote: This is entirely a question of API design. If it should be the caller's responsibility to check for some condition before calling the function, then you can throw an `Error`

Re: Comparing Exceptions and Errors

2022-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/4/22 9:43 PM, Steven Schveighoffer wrote: But I think you are still not supposed to continue execution. I'm not sure what a compiler might assume at this point, and I unfortunately can't find in the language specification where it states this. It might not be in there at all, the spec is

Re: Comparing Exceptions and Errors

2022-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/4/22 6:56 PM, kdevel wrote: On Saturday, 4 June 2022 at 16:55:31 UTC, Steven Schveighoffer wrote: [...] The point of an `Error` is that your code can assume it cannot happen. If it does happen, the code is invalid. According to my favorite dictionary "assume" means "take for granted"

Re: D for data science and statistics

2022-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 6/4/22 13:26, Nicolas wrote: > 2. What about its integration with data analysis tools? Do you think it > could be an alternative to, let's say, Python? I suspect Python is much more mature in that space. I would browse the following page, which lists many organizations using D for data

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 6/4/22 10:17, Ola Fosheim Grøstad wrote: > Why can't Error unwind the stack properly? Errors are thrown when the program is discovered to be in an invalid state. We don't know what happened and when. For example, we don't know whether the memory has been overwritten by some rogue code. Or

Re: Comparing Exceptions and Errors

2022-06-04 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 4 June 2022 at 22:31:38 UTC, Ola Fosheim Grøstad wrote: So what do you have to do to avoid having Errors thrown? How do you make your task/handler fault tolerant in 100% @safe code? Run it in a separate process with minimum shared memory.

Re: Comparing Exceptions and Errors

2022-06-04 Thread kdevel via Digitalmars-d-learn
On Saturday, 4 June 2022 at 16:55:31 UTC, Steven Schveighoffer wrote: [...] The point of an `Error` is that your code can assume it cannot happen. If it does happen, the code is invalid. According to my favorite dictionary "assume" means "take for granted" [1]. If `Error`s may happen how can

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 4 June 2022 at 22:01:57 UTC, Steven Schveighoffer wrote: You shouldn't retry on Error, and you shouldn't actually have any Errors thrown. So what do you have to do to avoid having Errors thrown? How do you make your task/handler fault tolerant in 100% @safe code?

Re: D for data science and statistics

2022-06-04 Thread Sergey via Digitalmars-d-learn
On Saturday, 4 June 2022 at 20:26:54 UTC, Nicolas wrote: Hi all! Pleased to meet you. I am currently deep-diving into data analysis and statistics with R and SQL. I got mid-level programming experience, focusing on algorithms and innovation instead of sticking to one programming language.

Re: Comparing Exceptions and Errors

2022-06-04 Thread kdevel via Digitalmars-d-learn
On Saturday, 4 June 2022 at 14:05:14 UTC, Paul Backus wrote: [...] What does that mean? Am I `Error` blind? Generally you do not need to subclass `Error` yourself. The most common way of throwing an `Error` in user code is to use `assert`, which (with default compiler flags) throws an

Re: Comparing Exceptions and Errors

2022-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/4/22 2:46 PM, Ola Fosheim Grøstad wrote: On Saturday, 4 June 2022 at 18:32:48 UTC, Sebastiaan Koppe wrote: Most wont throw a Error though. And typical services have canary releases and rollback. So you just fix it, which you have to do anyway. I take it you mean manual rollback, but

Re: D for data science and statistics

2022-06-04 Thread Alain De Vos via Digitalmars-d-learn
As i personally did not used Windows the last 5 years, i use as editor for any language: neovim-qt. Someone else might answer about good Windows editors. As for the other questions google "awesome dlang" will return interesting results. I consider Dlang general purpose as opposed to specialized

D for data science and statistics

2022-06-04 Thread Nicolas via Digitalmars-d-learn
Hi all! Pleased to meet you. I am currently deep-diving into data analysis and statistics with R and SQL. I got mid-level programming experience, focusing on algorithms and innovation instead of sticking to one programming language. I only got three questions: 1. Is there any extensive,

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 4 June 2022 at 18:32:48 UTC, Sebastiaan Koppe wrote: Most wont throw a Error though. And typical services have canary releases and rollback. So you just fix it, which you have to do anyway. I take it you mean manual rollback, but the key issue is that you want to retry on

Re: dlang compilers & licenses.

2022-06-04 Thread Alain De Vos via Digitalmars-d-learn
Nice , a lot of freedom with dmd & ldc.

Re: Comparing Exceptions and Errors

2022-06-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 4 June 2022 at 17:17:13 UTC, Ola Fosheim Grøstad wrote: Why can't Error unwind the stack properly? It does normally, but it doesn't destruct objects when those are in `nothrow` functions. Nothrow functions don't throw, so have no cleanup. You could argue it is strange that

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 4 June 2022 at 16:55:50 UTC, Sebastiaan Koppe wrote: The reasoning is simple: Error + nothrow will sidestep any RAII you may have. Since you cannot know what potentially wasn't destructed, the only safe course of action is to abandon ship. Why can't Error unwind the stack

Re: Comparing Exceptions and Errors

2022-06-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 4 June 2022 at 01:17:28 UTC, Steven Schveighoffer wrote: If a thread does not catch an error and end the program, that's a defect in druntime I think. If it tries to rethrow the exception in the main thread (oh, man I have to check... Yeah, this is what it does), then it's

Re: Comparing Exceptions and Errors

2022-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/4/22 7:57 AM, kdevel wrote: On Friday, 3 June 2022 at 23:40:50 UTC, Steven Schveighoffer wrote: During the last beerconf, I wrote a short blog post about how `Error` and `Exception` are different, and why you should never continue after catching `Error`s. Feedback welcome, I didn't

Re: Comparing Exceptions and Errors

2022-06-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 4 June 2022 at 14:19:22 UTC, Ola Fosheim Grøstad wrote: Also, what it is the purpose of @safe if you have to kill all threads? Such rigidity will just make Go look all the more attractive for service providers! I agree with this, but given the current semantics there is nothing

Re: What happened to Deimos and why ?

2022-06-04 Thread Alain De Vos via Digitalmars-d-learn
How come i don't see commit activity on github ?. The code is perfect or not maintained ?

Re: dlang compilers & licenses.

2022-06-04 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 4 June 2022 at 14:13:08 UTC, Alain De Vos wrote: Do DMD , GDC , LDC have the same or different licenses in use ? DMD https://github.com/dlang/dmd/blob/master/LICENSE.txt LDC https://github.com/ldc-developers/ldc/blob/master/LICENSE GDC

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 4 June 2022 at 01:17:28 UTC, Steven Schveighoffer wrote: I've thought in the past that throwing an error really should not throw, but log the error (including the call stack), and then exit without even attempting to unwind the stack. But code at least expects an attempt to throw

Re: What happened to Deimos and why ?

2022-06-04 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 4 June 2022 at 13:44:06 UTC, Alain De Vos wrote: What happened to Deimos and why ? Nothing, it does its job same as it always has.

dlang compilers & licenses.

2022-06-04 Thread Alain De Vos via Digitalmars-d-learn
Do DMD , GDC , LDC have the same or different licenses in use ?

Re: Comparing Exceptions and Errors

2022-06-04 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 4 June 2022 at 11:57:32 UTC, kdevel wrote: 2. Since 2017 or so I have written some 10 KLOC of D, maybe about two dozen classes deriving from Exception. But I did not annotate any of my methods or function with "nothrow" nor did I author any class deriving from `Error`.

What happened to Deimos and why ?

2022-06-04 Thread Alain De Vos via Digitalmars-d-learn
What happened to Deimos and why ?

Re: Comparing Exceptions and Errors

2022-06-04 Thread kdevel via Digitalmars-d-learn
On Friday, 3 June 2022 at 23:40:50 UTC, Steven Schveighoffer wrote: During the last beerconf, I wrote a short blog post about how `Error` and `Exception` are different, and why you should never continue after catching `Error`s. Feedback welcome, I didn't announce here when I wrote it because

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 6/3/22 18:17, Steven Schveighoffer wrote: > If a thread does not catch an error and end the program No, the thread dies and the main thread doesn't know anything about it. Unless if std.concurrency is being used and the main thread looks for and receives a LinkTerminated message. (If

Re: Comparing Exceptions and Errors

2022-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/3/22 8:44 PM, Ali Çehreli wrote: One feedback I have is about non-main threads. Although everybody agrees that Errors should not be caught, the main thread does so and prints the useful output that you show in the article. Yes, the one exception to the no-catch error rule is to print/log

Re: Comparing Exceptions and Errors

2022-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 6/3/22 16:40, Steven Schveighoffer wrote: https://www.schveiguy.com/blog/2022/05/comparing-exceptions-and-errors-in-d/ Cool! I didn't know catching Errors behaves specially in unittest blocks and contracts. One feedback I have is about non-main threads. Although everybody agrees that

Comparing Exceptions and Errors

2022-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
During the last beerconf, I wrote a short blog post about how `Error` and `Exception` are different, and why you should never continue after catching `Error`s. Feedback welcome, I didn't announce here when I wrote it because it's kind of small/insignificant, but maybe it can help newcomers to

Re: Dynamic Arrays Capacity

2022-06-04 Thread bauss via Digitalmars-d-learn
On Friday, 3 June 2022 at 12:52:30 UTC, Adam D Ruppe wrote: On Friday, 3 June 2022 at 12:49:07 UTC, bauss wrote: I believe it's only true in unicode for utf-32 since all characters do fit in the 4 byte space they have Depends how you define "character". I guess that's true as well, unicode