Skip to content

toLeopard: Strict number casting#149

Closed
towerofnix wants to merge 4 commits intoleopard-js:masterfrom
towerofnix:strict-number-casting
Closed

toLeopard: Strict number casting#149
towerofnix wants to merge 4 commits intoleopard-js:masterfrom
towerofnix:strict-number-casting

Conversation

@towerofnix
Copy link
Member

@towerofnix towerofnix commented Jul 1, 2024

Resolves #123. Related to leopard-js/leopard-mentors#4 and #150.

This PR implements the proposal most particularly outlined in #123 (comment). It's intended as an alternative, and probably lesser, option, compared to the "traits" system outlined in - well, the same comment ✨ - and we'd like to have a go at implementing that one, before merging this. However, both PRs should be equally effective in generally fixing issues to do with surprise NaN in converted projects. (That being the case, behavior-testing projects are much needed.)

We haven't looked into it in great detail yet, but it appears to - more or less - fix the behavior of the case project (leopard-js/leopard-mentors#4), which has code that apparently sets sprite sizes to NaN.

This code is from December 2023 and we haven't made any significant edits except for rebasing it onto current master.

@towerofnix towerofnix added compatibility Mismatch or currently unsupported language behavior fmt: Leopard Pertains to Leopard format (JavaScript) labels Jul 1, 2024
@towerofnix towerofnix changed the title Strict number casting toLeopard: Strict number casting Jul 2, 2024
towerofnix added a commit to towerofnix/sb-edit that referenced this pull request Jul 2, 2024
This commit includes (or should include) all the same NaN-handling
rules as researched and defined for pull request leopard-js#149, accounting
for almost all new logic / line additions in this commit.
@towerofnix towerofnix force-pushed the strict-number-casting branch from 385229a to 1c1b95a Compare July 2, 2024 18:28
@towerofnix towerofnix marked this pull request as ready for review July 2, 2024 18:28
@towerofnix towerofnix requested a review from PullJosh July 2, 2024 18:29
@towerofnix
Copy link
Member Author

Note for reviewing: refer to #150 (comment)

towerofnix added a commit to towerofnix/sb-edit that referenced this pull request Jan 15, 2026
This commit includes (or should include) all the same NaN-handling
rules as researched and defined for pull request leopard-js#149, accounting
for almost all new logic / line additions in this commit.
adroitwhiz pushed a commit that referenced this pull request Jan 15, 2026
This commit includes (or should include) all the same NaN-handling
rules as researched and defined for pull request #149, accounting
for almost all new logic / line additions in this commit.
@towerofnix towerofnix closed this Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility Mismatch or currently unsupported language behavior fmt: Leopard Pertains to Leopard format (JavaScript)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toLeopard: Static number casting issues in equality operator + NaN leaking

1 participant