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

[cpp] problem with deprecated implicit casts of cpp.Int64 #10998

Closed
dazKind opened this issue Mar 4, 2023 · 6 comments
Closed

[cpp] problem with deprecated implicit casts of cpp.Int64 #10998

dazKind opened this issue Mar 4, 2023 · 6 comments
Assignees
Labels
platform-cpp Everything related to CPP / C++

Comments

@dazKind
Copy link
Contributor

dazKind commented Mar 4, 2023

This is a breaking change that I noticed going from 4.2.5 -> 4.3.x / nightly.

#10133 was not included in the former 4.2.x releases and is included in nightly now.

I compiled a demonstration here: https://gist.github.com/dazKind/8a916288a9b4bdcf8b64ae6d2eee1265

While I agree that being explicit about truncation is a good thing, it totally breaks when you try to use implicit truncation in a for-loop. I would have assumed to get the deprecation warning here for the moment.

I also tried to explicitly iterate an int64 range using the normal for-loop syntax but that also assumes Int (32 bits) and doesnt work.

Ofc im not sure about the implications but maybe having a for (i in 0...someInt64) should default to typing the iterator to int64 and not assume int32 by default, given that an explicit toInt() will be required in the future.

@haxiomic
Copy link
Member

haxiomic commented Mar 14, 2023

Thanks for catching this! I think the ideal is the iterator is typed as Int64 although since it's a platform specific type this is more tricky

for (i in 0...someInt64) working was buggy before; it would only loop up to max int 32, which is probably not what the user wanted if they have an int64, so the explicit cast is helpful to communicate that

It would be better if the depreciation warning worked here

@Simn Simn added this to the Later milestone Mar 24, 2023
@dazKind
Copy link
Contributor Author

dazKind commented Apr 11, 2023

This issue is slowly getting problematic for me: My HxGodot library makes heavy use of cpp.Int64 due to the way the engine bindings work. Ever since the 4.3.0 release dropped, i experience an incline of user reports for the error: cpp.Int64 should be cpp.Int32-error and I need to tell people to revert to 4.2.5 :(

it would be really awesome if there was support for implicit cpp.Int64 for-loops

@Simn Simn modified the milestones: Later, 4.3 Hotfix Apr 11, 2023
@Simn Simn self-assigned this Apr 11, 2023
@Simn Simn added the platform-cpp Everything related to CPP / C++ label Apr 11, 2023
@Simn
Copy link
Member

Simn commented Apr 11, 2023

I think I misjudged this one when looking through the issues. Seems fair to consider abstract field casts for the interval operator.

@Simn Simn closed this as completed in ae7b31d Apr 11, 2023
@Simn
Copy link
Member

Simn commented Apr 11, 2023

Reopening for hotfix.

@Simn Simn reopened this Apr 11, 2023
@dazKind
Copy link
Contributor Author

dazKind commented Apr 11, 2023

@Simn Thx a lot for taking a look!
Looking at your changes it seems like you went for making the implicit truncation work. Do you also have plans to support actual int64 iterators/loops?

@Simn
Copy link
Member

Simn commented Apr 11, 2023

I wouldn't call it having plans, but I kinda want to design numeric types properly for Haxe 5 in general.

@kLabz kLabz closed this as completed Apr 11, 2023
@kLabz kLabz removed this from the 4.3 Hotfix milestone Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-cpp Everything related to CPP / C++
Projects
None yet
Development

No branches or pull requests

4 participants