You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not an expert on programming language analyzers, parsers, or interpreters. Working on features for GDScript is how I'm learning about them, I suppose. As such, I could be saying things here that don't make sense or aren't feasible for reasons beyond my knowledge. If so, please explain how/why, thanks! 😅
As I've been working on adding support for deprecated symbol warnings and recognition in the language server, I've found that in many places, the way native classes (like AnimationPlayer), user-defined script classes (coming from a .gd file), and Variants (maybe other things too?) are handled differently. This makes it more difficult and time-consuming to add in a feature that applies to the language in general (say, doing something specific for method calls), because you have to handle all of the different kinds of objects/values doing the same thing.
Say we wanted to have the GDScript engine do something special for calls to a pause() method.
The code:
varanim_player=$AnimationPlayeranim_player.pause() # <--- do something with this call
seems like it should use the same engine logic as:
varmy_thing: $MyThingmy_thing.pause() # <--- do something with this call
yet in reality, there are different code paths the engine has to follow, because the first one is a native class and the second one is a user-defined script class.
Providing some kind of unified API, so that most of the engine could just recognize both cases as "calling a method on an instance of a class" would simplify this greatly. It'd cut down on the amount of code in the engine themselves, and would also make it easier and more intuitive for features to be added, since they only need to be applied to a single overarching scenario.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Note
I'm not an expert on programming language analyzers, parsers, or interpreters. Working on features for GDScript is how I'm learning about them, I suppose. As such, I could be saying things here that don't make sense or aren't feasible for reasons beyond my knowledge. If so, please explain how/why, thanks! 😅
As I've been working on adding support for deprecated symbol warnings and recognition in the language server, I've found that in many places, the way native classes (like
AnimationPlayer
), user-defined script classes (coming from a.gd
file), and Variants (maybe other things too?) are handled differently. This makes it more difficult and time-consuming to add in a feature that applies to the language in general (say, doing something specific for method calls), because you have to handle all of the different kinds of objects/values doing the same thing.Say we wanted to have the GDScript engine do something special for calls to a
pause()
method.The code:
seems like it should use the same engine logic as:
yet in reality, there are different code paths the engine has to follow, because the first one is a native class and the second one is a user-defined script class.
Providing some kind of unified API, so that most of the engine could just recognize both cases as "calling a method on an instance of a class" would simplify this greatly. It'd cut down on the amount of code in the engine themselves, and would also make it easier and more intuitive for features to be added, since they only need to be applied to a single overarching scenario.
Beta Was this translation helpful? Give feedback.
All reactions