Skip to content

Use named with dotty #2

@JosiahParry

Description

@JosiahParry

I would really love to be able to access an object's names while destructuring. I was hoping that by using names(value) i could accomplish this due to the assignment method from dotty, but it isn't yet possible.

Here is a repro use case:

library(dotty)

env_vars <- list(
  "api_key" = "fbivyb137294hgwv",
  "hello" = "world",
  "current_user" = "josiah@parry.com"
)
for (i in seq_along(env_vars)) {
  .[k = names(value), v] <- env_vars[i]
}

In an ideal world it could look something like

for (.[k, v] in env_vars) {
   ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions