Skip to content
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

Programming Enhancements #504

Closed
nonunknown opened this issue Feb 21, 2020 · 3 comments
Closed

Programming Enhancements #504

nonunknown opened this issue Feb 21, 2020 · 3 comments

Comments

@nonunknown
Copy link

Describe the project you are working on:
I working on a adventure platformer.

Describe the problem or limitation you are having in your project:
Sometimes we need to type a lot of code and it gets very large and hard to get every little thing later when you need to get back to the code. So I want to present some features that in my vision would be better for programmers when using gdscript....

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

  • Tabbed Scripts
  • Manual code folding
  • in-editor Document Generation
  • for as
  • multiple var assign
  • overload
  • DEFINERS instead of if else while making plugins

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

Tabbed Scripts

Basic Enables the user to create tabs (sections) for his script.
Use case 1: Alberto wants to create a section for his variables declaration, so he can type @tabname between the variables scope:
tabbed1
this creates a tab which only shows what is between @one

Manual code folding

Let the user folds the code like func does.
Use case: Barney wants to fold his NFSW variables. so he uses '##' AnyName to start and ### to enclose

#this can be folded on gdscript
func abc():
   pass

## Fold this NFSW
onready var beauty_body = $armature/girl
###

In-editor Document Generation

The title describe itself, but I'll show here.
Use Case: Carlos downloaded an awesome plugin where enables godot to get any unity script and converts into gdscript, the plugin author was cool and created an awesome Documentation but carlos forget to download, so how it will use this fuck$ng awesome plugin? Don't be sad carlos cuz now you can only click on search help button and the docs will be there like any other godot class

Screenshot from 2020-02-21 19-18-29

For as

These days the script editor help us a lot when you type Raycast. godot shows you all related functions from it, but when you use for this doesnt happen so casting for would be perfect

#Before
for node in node.get_children():
    node.visible = false

#After
for node as Node in node.get_children():
   node.visible = false # this will show all Node class funcs

![Screenshot from 2020-02-21 19-27-47](https://user-images.githubusercontent.com/58845030/75077000-46798d00-54e0-11ea-## One line multiple var creation80d7-b697fa78f007.png)

Multiple var assign

Lets the user assign multiple variables in one line
Before

case 1:

var a:int = 0
var b:int = 0

case 2:
a = 10
b = a

After

case 1:
var a:int,b:int = 0

case 2:
b = a = 10

Overload

Same as C#

class FUN:
   func increase_fun():
      pass

   func increase_fun(a:int):
      pass

DEFINERS instead of if else while making plugins

Actually if the user wants to execute code in editor only this code is inside the gdscript, but I think that should be done at compile time so using definers like C++ does will be beautiful.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

Only the following one can be done with plugins:

  • Tabbed Scripts

Is there a reason why this should be core and not an add-on in the asset library?:
Yes, this will help a lot of devs, and most features presented "On my vision" can not by done via plugins

@aaronfranke
Copy link
Member

aaronfranke commented Feb 21, 2020

In-editor Document Generation

Would be nice, but first we would need a way to specify documentation in code, like /// <summary> in C#.

Overload

Workaround for now: Give the parameter a default value of null. Though, this does make it impossible to use static typing without nullable static types.

Multiple var assign

Just want to say that this is something I'd personally use if it were implemented. a = b = whatever is something I use often in C#. But then again, it's hardly a necessary feature, so I'd also be fine if it was never implemented.

DEFINERS instead of if else while making plugins

If this is implemented, it should work similarly to the C# preprocessor defines, which are available for any script and aren't restricted to plugins.

TL;DR: If you rely heavily on features like these, consider using C#. It also has manual folding via #region.

@nonunknown
Copy link
Author

yeah I agree with you, but I think on these things to "evolve" the gdscript language, my only problem with c# on godot for now is that mono version of the engine has a much higher compile time and I compile my projects many many times!!!

@Calinou
Copy link
Member

Calinou commented Sep 13, 2020

Closing, as you should open one proposal per requested feature after checking for possible duplicates. This makes it easier to track individual features' development status.

The features you requested below already have open proposals:

for as

#632

in-editor Document Generation

#993 (currently being implemented)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants