-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate sprite.vars.*
in favor of using class properties directly?
#196
Comments
Totally love it. Epic basketball score, lol.
I do think there are going to be awkwardnesses with project conversion that we... can't do a lot to avoid very prettily. I mean, the thing is that Leopard uses I wonder if we can avoid using names like Of course if sb-edit had some rather terrifying static analysis (leopard-js/sb-edit#98 (comment)) then we could just identify if a variable is only used within the function it converts into, and then just define it as a lexically bound variable with |
Love it. We can bikeshed the naming collision situation as much as we want. I'm happy with And yes, terrifying static analysis is absolutely a good idea, once we build up the courage. Anything that can be a local variable should be a local variable. (Maybe at some point in the future we'll revise this statement, but I think it's at least mostly correct.) |
I like the "private" thought, but I want to mention that it sort of conflicts with the Incidentally, |
Alright, I think that's a good enough reason not to choose the underscore syntax. Personally, between |
OK, so we just wrote up leopard-js/sb-edit#138 (comment) and found that Anytime verbiage could go one way or another and the world wouldn't end either way, we tend to not worry too badly about the outcome, LOL. Between
Bikeshedding is fun but also boring, so if you're conflicted and would like an outside decision to help you move on (we've been there lol), we vote |
Right now, Leopard targets (sprites and the stage) have a
.vars
object. Projects converted via sb-edit have all the Scratch variables converted to key/value pairs on the vars object.When I edit Leopard projects manually, I am constantly annoyed by this and choose to just assign things directly to the sprite itself instead, like so:
This gives a far more "normal" JavaScript development experience, which I think is better for Leopard users who are learning to write JS code.
The only argument I can think of in favor of
vars
is that it provides a namespace so that you can, for example, havethis.vars.x
be a variable andthis.x
be the sprite's x-position. In my opinion, it would be better to stop using this namespace and instead have sb-edit convert tothis.var_x
andthis.x
or similar.The text was updated successfully, but these errors were encountered: