Re: Comparing Exceptions and Errors

2022-06-03 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 spawnL

Re: Comparing Exceptions and Errors

2022-06-03 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-03 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 Er

Comparing Exceptions and Errors

2022-06-03 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-03 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 r

Re: Dynamic Arrays Capacity

2022-06-03 Thread Adam D Ruppe via Digitalmars-d-learn
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".

Re: Dynamic Arrays Capacity

2022-06-03 Thread bauss via Digitalmars-d-learn
On Thursday, 2 June 2022 at 20:12:30 UTC, Steven Schveighoffer wrote: This statement suggests to me that you have an incorrect perception of a string. A string is a pointer paired with a length of how many characters after that pointer are valid. That's it. `str.ptr` is the pointer to the fir