René's URL Explorer Experiment


Title: fix(#170): stop rewriting "-" as "-1*" before compiling by sspickle · Pull Request #223 · vpython/glowscript · GitHub

Open Graph Title: fix(#170): stop rewriting "-" as "-1*" before compiling by sspickle · Pull Request #223 · vpython/glowscript

X Title: fix(#170): stop rewriting "-" as "-1*" before compiling by sspickle · Pull Request #223 · vpython/glowscript

Description: Summary Fixes #170. Before compiling, the preprocessor rewrote every - as -1*, except after e/E in a number, after **, and before =. The goal was for -a**.5 to mean -(a**.5). But -1* binds tighter than the operator in front of it, so any negative operand after / or // came out wrong: Program Rewritten Result Python 3/-3 3/-1*3 −9 −1 7 // -2 7//-1*2 −14 −4 v/-2 <−2, −4, −6> <−0.5, −1, −1.5> RapydScript already gives unary minus the correct precedence relative to ** (-10**2 == -100, -x**-2 == -0.04). The vector operator overloading handles unary minus itself. So this PR just removes the rewrite. Testing I used a 39-case program run through GlowScriptOffline, with Python's own results as the expected answers. master this PR 7 division cases (3/-3, 7 // -2, x/-y, 1/-x**2, 2/-(x), v/-2, …) ❌ all wrong ✅ 32 cases the rewrite was protecting: -10**2, -x**-2, -2**0.5, 10**-2, 1e-3, 2E-2, x -= 3, f(-1), [-1, -2], range(-3, 0), plus vectors -v, -v.x**2, -mag(v)**2, -y*a, 3*-v, v - -v, -dot(v, a), a*-x/y ✅ ✅ JavaScript-mode programs (12 cases) ✅ ✅ (unchanged) 23 bundled demos no errors no errors package/ and the GlowScriptOffline RScompiler and compiler files were rebuilt with build_original_py3.py. Rebuilding master with the same toolchain reproduces its committed files byte for byte, so the diff in those files is only this change. Not fixed here % with a negative operand still follows JavaScript's remainder: 7 % -3 == 1, where Python gives −2. That's RapydScript's own behavior, not the preprocessor's. 2**-1**2 gives 0.25, where Python gives 0.5. This is also inside RapydScript. Both belong with #217, the RapydScript refresh. 🤖 Generated with Claude Code

Open Graph Description: Summary Fixes #170. Before compiling, the preprocessor rewrote every - as -1*, except after e/E in a number, after **, and before =. The goal was for -a**.5 to mean -(a**.5). But -1* binds tighter ...

X Description: Summary Fixes #170. Before compiling, the preprocessor rewrote every - as -1*, except after e/E in a number, after **, and before =. The goal was for -a**.5 to mean -(a**.5). But -1* binds tighter ...

Opengraph URL: https://github.com/vpython/glowscript/pull/223

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:715bf92f-1c44-7fb8-7f8f-85863c0d21ea
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE010:74B5:A34EA:E3D77:6B007FD6
html-safe-nonce48458a55ece8b0dad696c0c157caab944f559149022e1f448af8319b85246e76
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDEwOjc0QjU6QTM0RUE6RTNENzc6NkIwMDdGRDYiLCJ2aXNpdG9yX2lkIjoiMTg5MTc4MzQ0MTg0MjczMzAxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7b83a1a6a2fc427f978647dce90f5ca39827e86b81c254f7ce530a20ba50262b
hovercard-subject-tagpull_request:5108919032
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/vpython/glowscript/pull/223/files
twitter:imagehttps://avatars.githubusercontent.com/u/1708412?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1708412?s=400&v=4
og:image:altSummary Fixes #170. Before compiling, the preprocessor rewrote every - as -1*, except after e/E in a number, after **, and before =. The goal was for -a**.5 to mean -(a**.5). But -1* binds tighter ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None82c186f13e104004ab7bdb779f3195e59dd38bfde531aaa74b76470fc2462b83
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/vpython/glowscript git https://github.com/vpython/glowscript.git
octolytics-dimension-user_id1280757
octolytics-dimension-user_loginvpython
octolytics-dimension-repository_id187905631
octolytics-dimension-repository_nwovpython/glowscript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id187905631
octolytics-dimension-repository_network_root_nwovpython/glowscript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released1bc2aa1939001689f5ce935982c10a6138f745c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/vpython/glowscript/pull/223/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fvpython%2Fglowscript%2Fpull%2F223%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fvpython%2Fglowscript%2Fpull%2F223%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=vpython%2Fglowscript
Reloadhttps://github.com/vpython/glowscript/pull/223/files
Reloadhttps://github.com/vpython/glowscript/pull/223/files
Reloadhttps://github.com/vpython/glowscript/pull/223/files
vpythonhttps://github.com/vpython
glowscripthttps://github.com/vpython/glowscript
Codehttps://github.com/vpython/glowscript
Issues9 (9)https://github.com/vpython/glowscript/issues
Pull requests2 (2)https://github.com/vpython/glowscript/pulls
Actionshttps://github.com/vpython/glowscript/actions
Projectshttps://github.com/vpython/glowscript/projects
Security and qualityhttps://github.com/vpython/glowscript/security
Insightshttps://github.com/vpython/glowscript/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fvpython%2Fglowscript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fvpython%2Fglowscript%2Fissues%2Fnew%2Fchoose
sspicklehttps://github.com/sspickle
masterhttps://github.com/vpython/glowscript/tree/master
fix/170-negative-signhttps://github.com/vpython/glowscript/tree/fix/170-negative-sign
Conversation 0 https://github.com/vpython/glowscript/pull/223
Commits 1 https://github.com/vpython/glowscript/pull/223/commits
Checks 0 https://github.com/vpython/glowscript/pull/223/checks
Files changed https://github.com/vpython/glowscript/pull/223/files
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
fix(#170): stop rewriting "-" as "-1*" before compiling https://github.com/vpython/glowscript/pull/223/files#top
Show all changes 1 commit https://github.com/vpython/glowscript/pull/223/files
688143b fix(#170): stop rewriting "-" as "-1*" before compiling sspickle Nov 1, 2026 https://github.com/vpython/glowscript/pull/223/commits/688143b2ee60488be0a22001be1e68d357a7161d
Clear filters https://github.com/vpython/glowscript/pull/223/files
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
RScompiler.3.2.min.js https://github.com/vpython/glowscript/pull/223/files#diff-50f3f718ff48010287d03a68f18aa6f64417d1048e5afe73c8cca752fc369ed2
compiler.3.2.min.js https://github.com/vpython/glowscript/pull/223/files#diff-9d949ba68ba5eec2943f7d0d21e090f290d080459cbcf80ce861c4c621c79bf9
GScompiler.js https://github.com/vpython/glowscript/pull/223/files#diff-c5e06395fc07406665368f378fd4aa946cee660714d79d39d85586c67e59a27f
RScompiler.3.2.min.js https://github.com/vpython/glowscript/pull/223/files#diff-1e087fded8593149d31432ac69ef174d42b7b638de687c35459926f5160555ce
compiler.3.2.min.js https://github.com/vpython/glowscript/pull/223/files#diff-95766df75a2297e605722bdd60406191b48be2454191ab2dc5b252fcde03d4c6
GlowScriptOffline/glowscript_libraries/RScompiler.3.2.min.jshttps://github.com/vpython/glowscript/pull/223/files#diff-50f3f718ff48010287d03a68f18aa6f64417d1048e5afe73c8cca752fc369ed2
View file https://github.com/vpython/glowscript/blob/688143b2ee60488be0a22001be1e68d357a7161d/GlowScriptOffline/glowscript_libraries/RScompiler.3.2.min.js
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
GlowScriptOffline/glowscript_libraries/compiler.3.2.min.jshttps://github.com/vpython/glowscript/pull/223/files#diff-9d949ba68ba5eec2943f7d0d21e090f290d080459cbcf80ce861c4c621c79bf9
View file https://github.com/vpython/glowscript/blob/688143b2ee60488be0a22001be1e68d357a7161d/GlowScriptOffline/glowscript_libraries/compiler.3.2.min.js
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
lib/compiling/GScompiler.jshttps://github.com/vpython/glowscript/pull/223/files#diff-c5e06395fc07406665368f378fd4aa946cee660714d79d39d85586c67e59a27f
View file https://github.com/vpython/glowscript/blob/688143b2ee60488be0a22001be1e68d357a7161d/lib/compiling/GScompiler.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/vpython/glowscript/pull/223/{{ revealButtonHref }}
https://github.com/vpython/glowscript/pull/223/files#diff-c5e06395fc07406665368f378fd4aa946cee660714d79d39d85586c67e59a27f
https://github.com/vpython/glowscript/pull/223/files#diff-c5e06395fc07406665368f378fd4aa946cee660714d79d39d85586c67e59a27f
package/RScompiler.3.2.min.jshttps://github.com/vpython/glowscript/pull/223/files#diff-1e087fded8593149d31432ac69ef174d42b7b638de687c35459926f5160555ce
View file https://github.com/vpython/glowscript/blob/688143b2ee60488be0a22001be1e68d357a7161d/package/RScompiler.3.2.min.js
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
package/compiler.3.2.min.jshttps://github.com/vpython/glowscript/pull/223/files#diff-95766df75a2297e605722bdd60406191b48be2454191ab2dc5b252fcde03d4c6
View file https://github.com/vpython/glowscript/blob/688143b2ee60488be0a22001be1e68d357a7161d/package/compiler.3.2.min.js
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/vpython/glowscript/pull/223/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.