Re: cas and interfaces

2018-12-27 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 27 December 2018 at 12:07:48 UTC, Rene Zwanenburg wrote: On Tuesday, 25 December 2018 at 22:07:07 UTC, Johannes Loher wrote: Thanks a lot for the info, that clarifies things a bit. But it still leaves the question, why it works correctly when inheriting from an abstract class inste

Re: cas and interfaces

2018-12-27 Thread Rene Zwanenburg via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 22:07:07 UTC, Johannes Loher wrote: Thanks a lot for the info, that clarifies things a bit. But it still leaves the question, why it works correctly when inheriting from an abstract class instead of implementing an interface... Any idea about why that? Unlike i

Re: cas and interfaces

2018-12-25 Thread Johannes Loher via Digitalmars-d-learn
On Monday, 24 December 2018 at 11:23:32 UTC, Johan Engelen wrote: On Sunday, 23 December 2018 at 14:07:04 UTC, Johannes Loher wrote: [...] The types of the 2nd and 3rd arguments of `cas` do not have to be the same, and aren't in your case. I think what's happening is that you are overwriting

Re: cas and interfaces

2018-12-24 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 23 December 2018 at 14:07:04 UTC, Johannes Loher wrote: I recently played around with atomic operations. While doing so, I noticed a problem with the interaction of interfaces and cas. Consider the following program: ``` import core.atomic; import std.stdio; interface TestInterface

cas and interfaces

2018-12-23 Thread Johannes Loher via Digitalmars-d-learn
l 11 ``` i.e. a segmentation fault happens. When replacing "interface" with "abstract class" (https://run.dlang.io/is/sFaO1k), everything works as expected and the program outputs ``` true onlineapp.TestClass ``` Is this actually a bug or a fundamental limitation of cas and inter