You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
(pseudocode)
class Base {}
class Sub extends Base {}
interface Foo { var x(get,null):Base; }
class Foo { public var x(get,null):Sub; } // i think i wish this were
not a compilation error.
Level1.hx:8: lines 8-31 : Field scene has different type than in ILevel
Level1.hx:8: lines 8-31 : com.haxepunk.Scene should be Scene1
p.s. i am pretty sure that i always have and always will think that
last error message is backwards.
Juraj Kirchheim
unread,
Aug 24, 2015, 2:17:00 AM8/24/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
Assume this compiles:
class Base {} class Sub extends Base {}
interface IFoo { var x(get, set):Base; } class Foo implements IFoo { public var x(get, set):Sub; }
Then this can happen:
var foo = new Foo();
var ifoo:IFoo = foo;
ifoo.x = new Base();//ouch!
If anything, this could only work on readonly properties. In fact it does already for anonymous types: http://try.haxe.org/#210ee
Generally, nominal types are not too good with variance in Haxe. I don't quite know why, but I think that several target runtime don't really allow for it to start with. Haxe already does quite a dance to allow for variance on methods.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
hi,
> If anything, this could only work on readonly properties.
Thanks for the reminder. Probably ever time I hit this, I think I
maybe get re-told that immutability as the default is one way to get
this? I mean in some other language that starts off with immutability
as the main law of the land.
I mean, in my case right now, I'd be happy with it being read only
from the outside; see how my pseudo code had null in it.