Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread Dukc via Digitalmars-d-learn
On Monday, 4 January 2021 at 15:39:50 UTC, ludo456 wrote: Listening to the first visioconf of the Dconf 2020, titled Destroy All Memory Corruption, (https://www.youtube.com/watch?v=XQHAIglE9CU) Walter talks about not using exceptions any more in the future. He says something like "this is

Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread sighoya via Digitalmars-d-learn
Citing Herb Sutter: As noted in §1.1, preconditions, postconditions, and assertions are for identifying program bugs, they are never recoverable errors; violating them is always corruption, undefined behavior. Therefore they should never be reported via error reporting channels (regardless of

Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 06, 2021 at 05:36:07PM +, sighoya via Digitalmars-d-learn wrote: > On Tuesday, 5 January 2021 at 21:46:46 UTC, H. S. Teoh wrote: > > 4) The universal error type contains two fields: a type field and a > > context field. > > > > a) The type field is an ID unique to every thrown

Re: Static constructor

2021-01-06 Thread SealabJaster via Digitalmars-d-learn
On Thursday, 7 January 2021 at 01:55:07 UTC, SealabJaster wrote: ... And on a side note, I don't believe this code is working as the author intends. Someone correct me if I'm wrong, but `static` variables in D arethread-local, so a `static Object mutex` wouldn't actually be visible

Re: Static constructor

2021-01-06 Thread SealabJaster via Digitalmars-d-learn
On Wednesday, 6 January 2021 at 17:05:02 UTC, ludo wrote: ... Using a static class like this seems to mostly be a design decision. i.e. instead of using something like ``` openalGetMutex(); // OR OpenAL openal = ...; openal.getMutex(); // OR I guess even this g_openal.getMutex(); ```

Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 6 January 2021 at 21:27:59 UTC, H. S. Teoh wrote: It must be unique because different functions may return different sets of error codes. If these sets overlap, then once the error propagates up the call stack it becomes ambiguous which error it is. I don't think this is the

Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread sighoya via Digitalmars-d-learn
On Wednesday, 6 January 2021 at 21:27:59 UTC, H. S. Teoh wrote: It must be unique because different functions may return different sets of error codes. If these sets overlap, then once the error propagates up the call stack it becomes ambiguous which error it is. Contrived example:

Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2021-01-05 03:02, kdevel wrote: expected output: none. The compiler should have rejected the code after the duplicate definition def #2. dmd 2.093.1 ignores both definitions instead. Is this a bug or a bug? DMD 2.095.0 now reports an error for this. -- /Jacob Carlborg

Static constructor

2021-01-06 Thread ludo via Digitalmars-d-learn
I read in the documentation "Static constructors are used to initialize static class members with values that cannot be computed at compile time" I try to understand the design of the following code: --- class OpenAL { static string[int] ALErrorLookup; static Object mutex;

Re: Static constructor

2021-01-06 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 6 January 2021 at 17:05:02 UTC, ludo wrote: I read in the documentation "Static constructors are used to initialize static class members with values that cannot be computed at compile time" [...] Since this is not the complete code it's a bit hard to know, but I'd guess this

Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread sighoya via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 21:46:46 UTC, H. S. Teoh wrote: 4) The universal error type contains two fields: a type field and a context field. a) The type field is an ID unique to every thrown exception -- uniqueness can be guaranteed by making this a pointer to some static