Skip to content

[cpp] Callable comparison handling - #12763

Merged
Simn merged 5 commits into
HaxeFoundation:developmentfrom
Aidan63:callable-typeid
Mar 10, 2026
Merged

[cpp] Callable comparison handling#12763
Simn merged 5 commits into
HaxeFoundation:developmentfrom
Aidan63:callable-typeid

Conversation

@Aidan63

@Aidan63 Aidan63 commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Closes #12746

Hxcpp side : HaxeFoundation/hxcpp#1313

I've suspected there was some issues around this sort of thing, but the tests didn't throw anything up. Because the new callable handling creates wrapper functions for differing signatures, comparions between closures could start to go wrong.
This introduces a new based class for the callable which exposes a function which returns it's type, which is independent of the callable object itself. The value returned from this is then used for closure comparisons.

Aidan63 added 2 commits March 7, 2026 21:01
Otherwise they'd match against other functions of the same signature
@Aidan63

Aidan63 commented Mar 7, 2026

Copy link
Copy Markdown
Contributor Author

Cpp tests failing are expected until that hxcpp side is merged, but it seems like jvm and neko also fail to handle this.

@Simn

Simn commented Mar 7, 2026

Copy link
Copy Markdown
Member

Hmm, I thought this was handled on JVM by overriding equals. I'll take a look tomorrow.

@Simn

Simn commented Mar 9, 2026

Copy link
Copy Markdown
Member

I'm still not sure about this in general because in my opinion the equality check is simply lying here. I suppose one could say that this is true for strings as well because we don't check physical equality on them. And I guess it's a bit too late to discuss this anyway since it has been specified like this for a while now (although apparently not well tested).

Not sure what to do with neko though and if somebody wants to look into fixing that. It might be best to just ignore the tests on neko for now.

@Aidan63

Aidan63 commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

I'm happy to sweep the failing neko test under the carpet. I agree that this all seems odd, I had no idea functions had all these odd comparison cases until I started reworking hxcpp's closures. Hopefully there's not too much mad code out these using it...

@Simn
Simn merged commit f5087fe into HaxeFoundation:development Mar 10, 2026
50 checks passed
@Aidan63
Aidan63 deleted the callable-typeid branch March 10, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CPP] Equality check comes back incorrectly on nightly haxe

2 participants