Title: Clarify undefined behavior when target == source in PMatrix::mult docs · Issue #1591 · processing/processing4 · GitHub
Open Graph Title: Clarify undefined behavior when target == source in PMatrix::mult docs · Issue #1591 · processing/processing4
X Title: Clarify undefined behavior when target == source in PMatrix::mult docs · Issue #1591 · processing/processing4
Description: Hi folks! I know this won't be top priority, but this issue caused me to spin my wheels for a couple days straight since it was one of those times where all my logic "looked right" after many passes so I figured it might throw some other...
Open Graph Description: Hi folks! I know this won't be top priority, but this issue caused me to spin my wheels for a couple days straight since it was one of those times where all my logic "looked right" after many passe...
X Description: Hi folks! I know this won't be top priority, but this issue caused me to spin my wheels for a couple days straight since it was one of those times where all my logic "looked right" af...
Opengraph URL: https://github.com/processing/processing4/issues/1591
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Clarify undefined behavior when target == source in PMatrix::mult docs","articleBody":"Hi folks!\n\nI know this won't be top priority, but this issue caused me to spin my wheels for a couple days straight since it was one of those times where all my logic \"looked right\" after many passes so I figured it might throw some other beginners for a loop.\n\nI'd like to request additional clarity be added to the javadoc here:\n\nhttps://github.com/processing/processing4/blob/cd50e02e5a8cdf41f8bb165b6ebd85feeeeac543/core/src/processing/core/PMatrix.java#L165-L171\n\nSpecifically, I think that it should be stated explicitly that behavior is undefined when `target == source`. Since no warning was offered I did not expect for the contents of `source` to still be in the process of being read by the time that `target` is actually being populated within this method but it appears something like that is happening (my expectation was that the contents of `source` would have probably been extracted into local variables once at the beginning since there are so few elements in a `PVector` and then loaded into `target` once at the end after performing intermediate computations). Ideally, if there is no utility in allowing `target == source` whatsoever, this case should throw an exception but, alternatively, additional doc clarity would have been a noninvasive way of preventing prolonged confusion in my case. Also I think \"`target will then be the matrix returned`\" is a typo since this method is returning a `PVector`.\n\n[Here is an example sketch](https://gist.github.com/AndrewMatzureff/6700a271d6b34277cffae633659562a9) you can use to observe the undocumented undefined behavior. Move the mouse around without pressing anything to observe normal behavior when simply passing `target = null`. Similarly, pressing Right-click will set `target` equal to a `PVector` reference which is fixed across `draw()` frames--the outcome of which is normal behavior. Pressing Left-click will pass `target = source` triggering the undefined behavior.\n\nThanks!","author":{"url":"https://github.com/AndrewMatzureff","@type":"Person","name":"AndrewMatzureff"},"datePublished":"2026-10-30T23:57:04Z","url":"https://github.com/processing/processing4/issues/1591"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6b1f5a2f-adbd-cb83-c610-80145300be4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABFC:1F0299:FB7B6:15A523:6B05F78B |
| html-safe-nonce | 46056f5a646f26766c38f8281a0ce4a5dce65e716bf1c37650285e6a532e57e2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkZDOjFGMDI5OTpGQjdCNjoxNUE1MjM6NkIwNUY3OEIiLCJ2aXNpdG9yX2lkIjoiNTMxMDgwNjkzMjUxMTM4OTU4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e4f9cffd9b4b3743a89278ffd6dcb962feef3c13b329516b978efce61d9c1232 |
| hovercard-subject-tag | issue:6128842778 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/processing/processing4/1591/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a4513c1c7cfa7fd73a265abbe8556b79d05474d61a91c008c935f9eea4a02d63/processing/processing4/issues/1591 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a4513c1c7cfa7fd73a265abbe8556b79d05474d61a91c008c935f9eea4a02d63/processing/processing4/issues/1591 |
| og:image:alt | Hi folks! I know this won't be top priority, but this issue caused me to spin my wheels for a couple days straight since it was one of those times where all my logic "looked right" after many passe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AndrewMatzureff |
| hostname | github.com |
| expected-hostname | github.com |
| None | c214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece |
| turbo-cache-control | no-preview |
| go-import | github.com/processing/processing4 git https://github.com/processing/processing4.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 844382769 |
| octolytics-dimension-repository_nwo | processing/processing4 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 844382769 |
| octolytics-dimension-repository_network_root_nwo | processing/processing4 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d164a4e71eb333b2b17fd5b17e18efb7855505c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width