NicoM1 / IceEntity

A simple framework for managing entitys, components, and live-at-runtime scripts in haxeflixel
MIT License
58 stars 7 forks source link

Adding ability to access instance via property. #6

Closed gamedevsam closed 10 years ago

gamedevsam commented 10 years ago

It's less verbose, same performance, and fully backwards compatible.

NicoM1 commented 10 years ago

ah smart, that's a lot cleaner, I was trying to come up with a nicer way, this is it:) one question, in haxe, can't you just specify the variable with a getter? is there a need to have the separate private one?

NicoM1 commented 10 years ago

ok I also changed the default branch:)

gamedevsam commented 10 years ago

I think you should be able to use [@:isVar](http://old.haxe.org/manual/haxe3/migration#property-field-creation metadata) to avoid creating a private var. I'm not sure this code will work (I haven't tested it), but if it doesn't, you can always add back the private variable.

NicoM1 commented 10 years ago

what does @:isVar do? Why cant it be purely pubic if it has a null setter?

NicoM1 commented 10 years ago

ahh, I don't think its nessesary due to the null setter: http://old.haxe.org/manual/haxe3/migration#property-field-creation

NicoM1 commented 10 years ago

I guess haxe understands its a field because it cant be changed without being one

gamedevsam commented 10 years ago

You might be right... I removed it.

NicoM1 commented 10 years ago

Ok awesome, really helpful pull by the way!!:) thanks!!

gamedevsam commented 10 years ago

I think this framework will become a big deal for HaxeFlixel users. hscript support is very nice, especially now that openfl supports live asset reloading. Keep improving it!

NicoM1 commented 10 years ago

Thanks:) I really appreciate it, interestingly enough, while the live asset reloading prompted me to put in the feature, the actual live version is just using haxe IO

NicoM1 commented 10 years ago

the manual version still uses openfls system though

NicoM1 commented 10 years ago

uh oh, getting a stack overflow, gonna need to do some testing

NicoM1 commented 10 years ago

is it possible properties cant be set from static methods?

gamedevsam commented 10 years ago

No, you need to put back that private var... Apparently setting a property in its getter confuses haxe.

NicoM1 commented 10 years ago

ok yup, you were right in the first place:), thanks! I'll update the docs tomorrow, really appreciate it!:)