X Tutup
Skip to content

Document Object.connect() not supporting persistent connections with lambda functions#112487

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
Calinou:doc-object-connect-persist-no-lambda
Dec 18, 2025
Merged

Document Object.connect() not supporting persistent connections with lambda functions#112487
akien-mga merged 1 commit intogodotengine:masterfrom
Calinou:doc-object-connect-persist-no-lambda

Conversation

@Calinou
Copy link
Member

@Calinou Calinou commented Nov 6, 2025

@Calinou Calinou requested a review from a team as a code owner November 6, 2025 23:30
@Calinou Calinou added enhancement documentation cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Nov 6, 2025
@Calinou Calinou added this to the 4.6 milestone Nov 6, 2025
</constant>
<constant name="CONNECT_PERSIST" value="2" enum="ConnectFlags">
Persisting connections are stored when the object is serialized (such as when using [method PackedScene.pack]). In the editor, connections created through the Node dock are always persisting.
[b]Note:[/b] Connections to lambda functions (i.e. when the function code is embedded in the [method connect] call) cannot be made persistent.
Copy link
Member

@Mickeon Mickeon Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so, this ambiguity is why I personally adamantly avoid both "e.g." and "i.e.": Because of what "i.e." literally stands for, this note strongly implies that "lambda" functions are when code is embedded in connect(), and that's really the only exception to CONNECT_PERSIST.

We know both statements aren't true, or at least it's quite misleading, so no point explaining it. However, I must note that we're working with "Callables" here, not just "functions".
In fact, what could be worth testing for this purpose is one fire-sure way to determine whether a Callable is a lambda or not.

No suggestion yet, it's late at night.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe you can add this description on the connections page?

Copy link

@moonvent moonvent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for your explanation

@Calinou Calinou force-pushed the doc-object-connect-persist-no-lambda branch from 831f645 to 1d0e988 Compare November 10, 2025 21:11
@Calinou Calinou force-pushed the doc-object-connect-persist-no-lambda branch from 1d0e988 to 475e792 Compare December 18, 2025 01:35
@akien-mga akien-mga removed cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Dec 18, 2025
@akien-mga akien-mga merged commit 823cb06 into godotengine:master Dec 18, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup