Use "$" as the Scene Unique Node symbol #4497
Replies: 1 comment 3 replies
-
Options: 1. The main problem is the intersection with comments in GDScript: 2. 3. Some other character, such as 4. Leave |
Beta Was this translation helpful? Give feedback.
-
I had an idea on a whim, but I currently find difficult to articulate it in a proper... proposal, and I would like to see what the community at large thinks first.
This is following Scene Unique Nodes, whose functionality uses the "%" symbol across the board.
In GDScript, the
$
operator is a neat shortcut toget_node()
. Quite useful, integrated, neat.Let's really really make this the "get this node" operator.
$ has a pretty... uniquely recognisable shape. I believe using it to mark a Node's uniqueness would be great. There isn't much to confuse, because $ in GDScript already has a great correlation with nodes, and most other languages don't make use of the symbol, either.
And to add to this, a
$$
operator could be used to specifically fetch Unique Nodes. It's like a powered-up$
.Using the already existing symbol that is about fetching Nodes to fetch Nodes but differently is a neat way to familiarise with the new concept and it feels less arbitrary.
In a way, it would also implement Make the $ operator in GDScript cache node references (or add a $$ operator) #996 in a nicely, more unique way.
Imagine the following code:
This would, of course, disallow naming nodes containing "$". but even then, generally speaking, why would one do that? Because of the operator's existence in GDScript, referring to them in code as
$"Some$Node$Name"
is quite puzzling on its own.Beta Was this translation helpful? Give feedback.
All reactions