7
$\begingroup$

In 11.2 I was spelunking with GeneralUtilities`PrintDefinitionsLocal and noticed that everything seemed to have a SubValues kernel function.

This struck me as odd so I tried:

With[{s = Evaluate@Unique[sym]},
 s // System`Private`HasSubCodeQ
 ]

True

It seems System`Private`HasSubCodeQ is broken (which is a big pain for meta-programming).

Anyone else have this issue?

$\endgroup$
9
  • 1
    $\begingroup$ I confirm the issue with version 11.2.0 on Win7 x64. GeneralUtilities`PrintDefinitionsLocal@a returns a[___][___] := <<kernel function>>; for undefined symbol a what is obviously a bug. Please report it. $\endgroup$ Sep 19, 2017 at 9:57
  • $\begingroup$ This is undocumented functionality tho, so even if you report it, this would probably be low-priority. $\endgroup$ Sep 19, 2017 at 10:33
  • $\begingroup$ @AlexeyPopkov and b3m2a1, Can you reproduce the problem with documented functionality? If not I don't agree it is a bug. The more that With[{s = Evaluate@Unique[sym]}, SubValues@s] behaves correctly and so does With[{s = Evaluate@Unique[sym]}, Language`ExtendedFullDefinition@s] which is used by top level functions. But yes, interesting question. $\endgroup$
    – Kuba
    Sep 19, 2017 at 21:39
  • 1
    $\begingroup$ This is the issue with undocumented functionality, it may break your code in future and you are not supposed to blame anyone :) I'm removing bug but will gladly revert that if WRI Support or someone familiar with internals confirms it. $\endgroup$
    – Kuba
    Sep 19, 2017 at 21:40
  • 3
    $\begingroup$ This has been fixed in the development build today. $\endgroup$
    – ilian
    Oct 3, 2017 at 22:06

1 Answer 1

5
$\begingroup$

This has been fixed as of version 11.3.0:

With[{s = Evaluate @ Unique[sym]}, s // System`Private`HasSubCodeQ]

(* False *)
$\endgroup$
5
  • $\begingroup$ Great. My documentation generator will work again. I assume HasPrintCodeQ is also fixed? $\endgroup$
    – b3m2a1
    Mar 11, 2018 at 4:26
  • $\begingroup$ Not quite sure, in what way was it broken? $\endgroup$
    – ilian
    Mar 11, 2018 at 4:34
  • $\begingroup$ Same way. I just checked and it's also working again. $\endgroup$
    – b3m2a1
    Mar 11, 2018 at 4:35
  • $\begingroup$ Strange, does not seem broken in my 11.2. $\endgroup$
    – ilian
    Mar 11, 2018 at 4:36
  • $\begingroup$ Interesting. I've overwritten my 11.2 with 11.3 but I was pretty sure it was feeding me spurious results. $\endgroup$
    – b3m2a1
    Mar 11, 2018 at 4:37

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.