Clarify undefined behavior when target == source in PMatrix::mult docs

Abierto Apto para principiantes
#1,591 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
85/100
Tipo de issue
Documentación
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

Lee el Javadoc de PMatrix.mult en core/src/processing/core/PMatrix.java, alrededor de las líneas 165–171. Aclara qué sucede cuando target y source son el mismo objeto y corrige la redacción que llama matriz al valor devuelto. El trabajo estará terminado cuando la documentación describa el comportamiento con precisión e identifique el valor devuelto como un PVector.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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 beginners for a loop.

I'd like to request additional clarity be added to the javadoc here:

https://github.com/processing/processing4/blob/cd50e02e5a8cdf41f8bb165b6ebd85feeeeac543/core/src/processing/core/PMatrix.java#L165-L171

Specifically, 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.

Here is an example sketch 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.

Thanks!

Lenguaje dominante
Java
Estrellas
527
Forks
190
Merge medio
1 d 4 h
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de processing/processing4

Todos los issues de processing/processing4

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.