Re: Casting to interface not allowed in @safe code?

2019-06-25 Thread Eugene Wissner via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 16:51:46 UTC, Nathan S. wrote: On Sunday, 23 June 2019 at 21:24:14 UTC, Nathan S. wrote: https://issues.dlang.org/show_bug.cgi?id=2. The fix for this has been accepted and is set for inclusion in DMD 2.080. 088 :)

Re: Casting to interface not allowed in @safe code?

2019-06-25 Thread Nathan S. via Digitalmars-d-learn
On Sunday, 23 June 2019 at 21:24:14 UTC, Nathan S. wrote: https://issues.dlang.org/show_bug.cgi?id=2. The fix for this has been accepted and is set for inclusion in DMD 2.080.

Re: Casting to interface not allowed in @safe code?

2019-06-23 Thread Nathan S. via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:59:13 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:33:17 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:33:17 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:19:38 UTC, Marco de Wild wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread rumbu via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base isn't implementing FeatureX, but foo is really a Foo

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, May 21, 2019 at 7:55 AM Jim via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi, > > Question: How to call foo.x in @safe code ? > @safe: interface Base { void setup(); } interface FeatureX { void x(); } interface FeatureY { void y(); } class Foo: Base,

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Marco de Wild via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo = new Foo(); // This would be the result of a factory class

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base isn't implementing FeatureX, but foo is really a Foo which does: class Foo: Base, FeatureX { void

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread rumbu via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo = new Foo(); // This would be the result of a factory class