On Mon 27 Feb 2017 20:21, Andy Wingo <wi...@pobox.com> writes: > Hi, > > On Mon 27 Feb 2017 11:06, Alejandro Sanchez <hiph...@openmailbox.org> writes: > >> (define v (make <vector3> #:x 1)) >> >> (* -1 v) ; Does not work >> (* -2 v) ; Works fine > > I believe that Guile is doing strength reduction, transforming (* -1 v) > to (- 0 v).
I spoke too soon. Guile 2.1.x does indeed do this at compile-time, but only if "v" is an instance of a built-in number type. Guile 2.0.x doesn't do this strength reduction at all at compile-time. It turns out there is an easier way to reproduce this bug without GOOPS: (* -1 "") scm_product was handling this case specially because of weird implementation reasons (making sure that negating the most negative fixnum was a bignum; see b5c40589). In summary I think Guile's strength reduction is fine as it relies on type inference to prove when it is safe. This is "just" a bug, albeit an annoying one that we need to fix! Andy