f[x] ^= 1;

returns True in Mathematica 12.2. Is it a bug?


1 Answer 1


The behavior of ValueQ has changed in version 12.2. In fact, you can provide a Method -> "Legacy" option to match the behavior the function had in Version 12.1 and earlier:

reproducing old behavior

The Details portion of the documentation for ValueQ now states that the default method in the 12.2 implementation (Automatic) effectively uses "OwnValuesPresent" if expr is a symbol and "SymbolDefinitionsPresent" otherwise (which means that "one or more symbols have any sort of definition present"). As I understand it, g[x] is not a symbol, so the latter is used.

This change for version 12.2 is also mentioned in the list of incompatible changes between MMA versions.

  • 4
    $\begingroup$ This is also mentioned in the list of incompatible changes. $\endgroup$ Commented Jan 8, 2021 at 22:25
  • $\begingroup$ @J.M. Good pointer! I added the link. I had not come across that list yet: very instructive read. $\endgroup$
    – MarcoB
    Commented Jan 8, 2021 at 22:42
  • $\begingroup$ So, the up value of x counts by default. Still, I can not think of any use case of such a behavior and would consider this as a bug. $\endgroup$
    – Roma Lee
    Commented Jan 9, 2021 at 3:11
  • $\begingroup$ I noticed this when working through L. Shrifkin's programming text (section 2.2.7). Can anyone explain the motivation for the change, which to me makes more sense than the pre 12.2 behavior? $\endgroup$ Commented Apr 6, 2021 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.