Allow implicit multiline chaining without backslash (or parentheses) when using Builder pattern in GDScript #12917
ElvisVilla
started this conversation in
Scripting
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, im working on a declarative UI for Godot Engine inspired in SwiftUI. Im using Builder pattern and Factory Methods to handle Control Node creation to enable a sintax similar to what Tween does, like this:
This is an odd sintax at the end, seems like for the Label and the Button doing the multiline chain is possible because the ',' separator defines the end of the expresion.
It is posible to enclose (VBox) in parentesis and this can be overpass but this is easily to forget and easily to delete and prone to errors, this hugely affect the usability of fluent API by method chaining in Godot.
I have also found that it is posible to do line breaks with ternary expresion in Godot, and I wonder if its posible to enable this for Builder pattern. Im not versed my self in Lenguage development, i was doing some chat with Claude about this, to see how to write this discussion and Claude gave me this :
This could open the posibility to do this
Enabling method chaining without backslash improves imensively the usability of method chaining in GDScript.
Beta Was this translation helpful? Give feedback.
All reactions