Skip to content

box::use() Fails for Modules Under Folders Whose Names Begin with Numbers #235

@GregYannes

Description

@GregYannes

Naturally, one should not name their module 1_number, since this module becomes its own environment in R, and no such R objects may have a name beginning with number. The same goes for any other names illegal in R.

However, if a local module one_number can be found along a relative filepath ./path/2/one_number.R, then box::use(./path/2/one_number) will fail:

Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  Expected identifier in module prefix, got 2
(inside “parse_mod_prefix(expr[[2L]])”)

This is likely a minor issue, but it could throw newcomers for a loop. While everything under the global box.path is presumably a module (nested or otherwise) unto itself, the same cannot be said of local filepaths, and their directories (which need not be modules) should not be bound to naming conventions for R objects. Indeed, one might be forced to rename the entire subdirectory system within one's project.

Is this worth a patch? Perhaps box::use("./path/2/one_number") should be possible, if the unquoted declaration would fail...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions