Skip to content

What's the difference between box::use and the double colon operator (i.e., ::)? #358

Answered by klmr
SaintRod asked this question in Q&A
Discussion options

You must be logged in to vote

There are two differences:

First off, ‘box’ supports loading modules, not just packages. Modules are a modern way of organising and reusing code which is more lightweight and powerful than packages. When organising hierarchical projects in Rhino, you are using modules. Packages have no equivalent functionality. For more details, refer to the Get started vignette.

Secondly, when using packages without ‘box’, you basically have to choose between two options:1

  1. attach all names globally (via library(pkgname))
  2. don’t attach any names and qualify them all explicitly every time via pkgname::function().

‘box’ gives you a lot more choices. For starter, attachment doesn’t happen globally but local…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@klmr
Comment options

@SaintRod
Comment options

Comment options

You must be logged in to vote
1 reply
@SaintRod
Comment options

Answer selected by SaintRod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants