7
$\begingroup$

Wolfram Workbench has a graphical editor for PacletInfo.m files. It is possible to add a "Kernel" extension with Symbols, Root and Context keys.

What is the purpose of each of these? Where is the documentation for this (if it exists)?

enter image description here

Sometimes it is also possible to add an Application extension with Root and Context keys:

enter image description here

It is not yet clear to me when the Workbench offers adding "Application" and when it offers "Kernel". I believe I created a "Mathematica Application" in both cases, but I'm not yet experienced with the Workbench ...

What is the difference between them?


Partial answer

Based on this comment by Teake Nutma, setting the "Context" allows usage message to have the little >> sign at the end. Clicking it opens the Documentation Centre. I tried this and it worked both in the Kernel and Application extensions (within two separate projects).

$\endgroup$
2
  • $\begingroup$ Related comment re Context. $\endgroup$
    – Michael E2
    Commented Nov 6, 2016 at 10:32
  • $\begingroup$ @MichaelE2 I tried it and setting Context either in Kernel or Application does cause the >> sign to appear at the end of the usage messages. $\endgroup$
    – Szabolcs
    Commented Nov 6, 2016 at 11:50

1 Answer 1

4
$\begingroup$

Update:

This answer is now mostly superseded by:


I am not sure about the difference between "Kernel" and "Application", but I was able to gather the following information:

Adding the "Kernel" extension to PacletInfo.m allows the paclet to provide a package that is loadable with Needs. (I have not tried if "Application" works too).

In order for this to work, it seems to be necessary to set the Context and Root arguments, like so:

Paclet[
    Name -> "MyPack",
    Version -> "0.0.1",
    MathematicaVersion -> "10.0+",
    Description -> "My Mathematica Application",
    Creator -> "John Johnson",
    Extensions -> 
        {
            {"Kernel", Root -> ".", Context -> "MyPack`"}
        }
]

Effects of setting Context -> "MyPack`":

  • FindFile["MyPack`"] will resolve to the correct location so that the package can get loaded by Needs or Get.

  • If the "Documentation" extension is also present, then symbol usage messages will get a little >> sign at the end. Clicking it will open the correct documentation page.

  • The value can also be a list of contexts.

Effects of setting Root:

  • FindFile["MyPack`"] will search in the location that Root points to in the usual manner: it will resolve either to init.m, to Kernel/init.m, to MyPack.m (or I assume to the other usual possibilities such as .mx files within directories having names agreeing $SystemID—but I haven't tried this one)

    The usual setting would be Root -> "." when the package root coincides with the paclet root, but we can also put all the package files and an init.m in a subdirectory and point to that instead.

Further reading

References

$\endgroup$
2
  • $\begingroup$ Where can I find more information about what Root -> "." does? Thanks $\endgroup$
    – QuantumDot
    Commented Nov 14, 2016 at 15:24
  • $\begingroup$ @QuantumDot I listed all my references ... the rest is experimentation. If you find out more, let me know! I just updated the answer. I believe that it works like this: if we set Context to something, then FindFile with that context will first go to Root, then keep searching from there for Contextname.m, init.m, Kernel/init.m and perhaps other standard thing. Sorry about responding late, I had to do a few more experiments. $\endgroup$
    – Szabolcs
    Commented Nov 15, 2016 at 16:46

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.