9
$\begingroup$

Try the following on a fresh kernel in 11.3

Options[Unevaluated[Plot]]
(* {} *)

The problem is that Plot -besides many other functions- is now auto-loaded when you need it. When you call

Options[Plot]

it shows all options, because in the evaluation chain, the symbol Plot is evaluated and therefore loaded for you.

There is a major problem though. What if you want to extract the options for many symbols? Wolfram took care that now some symbols will connect to servers, download the whole internet or have other side-effects merely by touching them.

Let's try to invoke Options for all System` symbols

Do[
  ToExpression[s, InputForm, Options],
  {s, Names["System`*"]}
];

After some seconds, I'm left with this

img

and after a while, my screen is full of error messages. Therefore, on the one hand, I have to evaluate many functions before I can get their options and on the other hand, hell breaks loose when I do it.

Would someone know if there is a way to auto-load all symbols without explicitly evaluating them?

$\endgroup$
2
  • 3
    $\begingroup$ The issue is that the .mx files that implement these packages are loaded by Package`ActivateLoad. The updates are done within these .mx files (so I don't think there's a way). On the other hand it seems your biggest issue is the fact that they try to download/update their packages so you could try Block[{PacletManager`PacletInstall, PacletManager`PacletCheckUpdate, PacletManager`PacletUpdate}, ...] $\endgroup$
    – b3m2a1
    May 21, 2018 at 0:49
  • $\begingroup$ @b3m2a1 Good catch (as long as I'm not after the options of these functions). Another thing that vastly improves the situation is the check if the symbol starts with a $. These are all "variables" and not "functions" as far as I can tell and they don't have options. $\endgroup$
    – halirutan
    May 21, 2018 at 10:09

1 Answer 1

8
$\begingroup$

If you just need to look at the symbol options you don't need to load it any more, you can use WolframLanguageData to get all sort of information about symbols:

WolframLanguageData["Plot", "Options"] // Short

(* {"AlignmentPoint" -> "Center", <<58>>, 
 "WorkingPrecision" -> "MachinePrecision"} *)

I assume it is contained in some downloadable paclet as it has no influence on the autoloads

Options[Unevaluated[Plot]]

(* {} *)

OwnValues[Plot]

(* {HoldPattern[Plot] :> 
  System`Dump`AutoLoad[Hold[Plot], 
    Hold[Plot, RegionPlot, DensityPlot, ContourPlot, ParametricPlot, 
     Plot3D, ContourPlot3D, ParametricPlot3D, RegionPlot3D], 
    "Visualization`SampledPlots`"] /; System`Dump`TestLoad} *)

If you plan to do that for multiple symbols, I suggest to use the listability in the first and second arguments to minimize the server calls

names = Names["System`*"];
options = 
  AssociationThread[names, WolframLanguageData[names, "Options"]];
$\endgroup$
2
  • 3
    $\begingroup$ Thanks for this answer. I was aware of this, but unfortunately this is only 2nd hand information which means someone extracted it and whatever he did not like to include is not included. To give an example: This is one of the functions that is often used by moderately advanced users: WolframLanguageData["Developer`ToPackedArray", "Options"]. I should have made more clear that I need not only System symbols. I'm after everything :) Still, nice you have written it down +1 $\endgroup$
    – halirutan
    May 21, 2018 at 10:01
  • $\begingroup$ If you are not afraid of a dirty kernel or of exporting and quitting you may try DeleteCases[ AssociationThread[ Names["System`*"], Options /@ ToExpression[Names["System`*"], InputForm, Unevaluated] ], {}]. $\endgroup$
    – Batracos
    May 23, 2018 at 15:45

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.