I think I read somewhere that Needs is the recommended way to import dependencies, but I usually see << used in examples. The documentation seems to be saying that << is just alternative syntax for Get. The documentation for Needs says that it calls Get, but does not explicitly say whether or not it does anything else and what that might be. Is there a more more precise statement of the relation between these somewhere?
Asked
Active
Viewed 113 times
3
Szabolcs
- 234,956
- 30
- 623
- 1,263
Daniel Mahler
- 1,095
- 8
- 16
Getand<<are the same thing as far as I know.NeedscallsGetonly if the package was not loaded already. If the package is already loaded, thenNeedsis smart enough to know this and will not reload it. Sometimes reloading the same package again might cause a problem (that is what I read somewhere). Not sure of why and how. So, it is better to useNeedsI would think, just in case the package itself was not designed to be aware of itself being loaded before, or it assumed it was not loaded. I think a well designed package should not cause a problem with multipleGet. – Nasser Mar 30 '14 at 13:31Needswill let Mathematica know the names that are publicly declared in the package (typically by means of::usagemessage definitions), even though their definitions are not yet available. Is this incorrect? – murray Mar 30 '14 at 15:10