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

Stancjs: Check input JS types before conversion #1475

Merged
merged 9 commits into from
Dec 11, 2024

Conversation

WardBrian
Copy link
Member

Closes #1446 by improving the error message. Note that the actual bad behavior is in RStan, c.f. stan-dev/rstan#1145

Submission Checklist

  • Run unit tests
  • Documentation
    • If a user-facing facing change was made, the documentation PR is here:
    • OR, no user-facing changes were made

Release notes

stanc.js will now properly complain if it is supplied with bad javascript types for its arguments.

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

@WardBrian WardBrian added cleanup Code simplification or clean-up interface command line interface stancjs labels Dec 5, 2024
Copy link
Collaborator

@nhuurre nhuurre left a comment

Choose a reason for hiding this comment

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

Closes #1446 by improving the error message.

Will this stanc3 change go out before RStan gets fixed? If not then technically users won't see the new error message and it was the RStan fix that closed issue 1446. If yes, then I think it would be worthwhile to try to fix the issue here as well. If it's just RStan passing array-of-strings instead of a single string, then concatenating the strings should be easy.

@WardBrian
Copy link
Member Author

Will this stanc3 change go out before RStan gets fixed? If not then technically users won't see the new error message and it was the RStan fix that closed issue 1446.

The RStan experimental branch picks up nightly, but this issue is present in the current CRAN release (based on Stan 2.33), so it really has to be fixed by them for most users to benefit, since updating to a more recent version will take another long while I assume. RStan’s string preprocessing of the model code is broken in at least 3 ways right now, and I don’t think the compiler can or should take on the burden of trying to fix it…

Anyway, I think technically finding the cause and opening the RStan issue is the thing that resolves 1446 from the compilers perspective. This is mostly just trying to play a little nicer (and trying to cut down on the noise in the issue list, since it will no longer give a link to open one here)

@WardBrian
Copy link
Member Author

I also think we should probably merge this after the release, just because it does touch a lot of the stancjs driver

@WardBrian WardBrian merged commit 82ed849 into master Dec 11, 2024
3 checks passed
@WardBrian WardBrian deleted the fix/stancjs-input-type-checking branch December 11, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code simplification or clean-up interface command line interface stancjs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal compiler error: TypeError: a.charCodeAt is not a function
2 participants