Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to achieve variable reference #1309

Open
astraw99 opened this issue Oct 31, 2022 · 3 comments
Open

How to achieve variable reference #1309

astraw99 opened this issue Oct 31, 2022 · 3 comments

Comments

@astraw99
Copy link

Currently, there are 2 cases below will get error, how to achieve it?
Case 1:

let var1 = "key1"
let var2 = ./dir/${var1}/file.dhall

Case 2:

let SchedulerConfig = ./dir/file.dhall
let schedulerPlugin = "plugin1"
let config = SchedulerConfig.${schedulerPlugin}.makeSchedulerConfig
@Gabriella439
Copy link
Contributor

This is currently not possible in Dhall. Specifically, Dhall does not permit computed imports paths (either for file paths or URLs) nor does Dhall permit computed field names

@astraw99
Copy link
Author

astraw99 commented Nov 5, 2022

Got it. Did we (Dhall) have planning to support this?

@Gabriella439
Copy link
Contributor

Gabriella439 commented Nov 5, 2022

It's up to what people propose and standardize, but:

  • the main reason why attributes currently don't support computed names is that it would complicate the type system
  • the main reason why imports currently don't support computed paths is for security reasons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants