box icon indicating copy to clipboard operation
box copied to clipboard

Add explicit binding

Open stefanoborini opened this issue 2 years ago • 4 comments

I thought I already filed this, but I cannot find it. Sorry if it's a reiterated request.

The problem we have with box is that the imported symbols are not explicitly bound. This angers linters, that see a symbol appear out of thin air and start complaining.

Example

box::use(mod/hello_world)

hello_world$hello('Ross')

This would trigger a linter problem because hello_world appears from nowhere.

I propose to support the additional syntax

hello_world <- box::use("mod/hello_world")

hello_world$hello('Ross')

This has the added benefit of allowing for easy renaming of the module in case of collision.

stefanoborini avatar Feb 08 '24 09:02 stefanoborini

Second this, as I have to disable the OBJECT_USAGE_LINTER from {lintr} in codebases using {box} for this reason. However, wondering if support for box::use() syntax could be incorporated into {lintr} to maintain the current syntax, as I think that matches syntax extremely common in Python and many other languages.

caldwellst avatar May 29 '24 10:05 caldwellst

https://github.com/r-lib/lintr/issues/2060

caldwellst avatar May 29 '24 10:05 caldwellst

@caldwellst Please take a look at {box.linters}. We would appreciate feedback.

radbasa avatar Jun 06 '24 08:06 radbasa

Ah thanks so much, will 100% do so!

caldwellst avatar Jun 06 '24 08:06 caldwellst