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

Suggestion: allow use of variables #829

Closed
gustavofujita opened this issue Jun 24, 2021 · 7 comments
Closed

Suggestion: allow use of variables #829

gustavofujita opened this issue Jun 24, 2021 · 7 comments

Comments

@gustavofujita
Copy link

Something like string interpolation:

key = "value"
another = "The value is %value%"

ip = "10.0.0.1"
server_ip = %ip%
remote_ip = %ip%

@pradyunsg
Copy link
Member

I don't think this complexity belongs in TOML -- rather it is better suited for a templating engine or as an application-specific, if it is deemed necessary by the tool authors.

This has been previously brought up in #686, #528, #606 and more. Please read those.

@KOLANICH
Copy link

KOLANICH commented Dec 2, 2022

It is a feature of YAML.

@KOLANICH
Copy link

KOLANICH commented Dec 2, 2022

(partially, no templating, but pointers reuse are supported)

@marzer
Copy link
Contributor

marzer commented Dec 2, 2022

It is a feature of YAML.

This alone is not really an argument for or against it being a part of TOML (personally I'm very strongly against bringing TOML closer to YAML for many, many reasons); different languages can have different scopes, and that's OK.

@KOLANICH
Copy link

KOLANICH commented Dec 2, 2022

I completely aggree. I personally am aginst interpolation in package metadata formats, because package metadata are the thing that must be automatically scannable and indexable. But allowing sharing vars opens it to billion laughs attack.

@Moosems
Copy link

Moosems commented Apr 8, 2023

I believe that variables in a data-oriented language can still be simplistic and it removes a lot of boilerplate code and repetition.

@eksortso
Copy link
Contributor

eksortso commented Apr 8, 2023

This issue was closed months ago. @Moosems If you have an idea for a very simple (and very safe) way to implement variables and string interpolation in TOML without making the standard any less obvious upon first inspection, then go ahead and open a brand new issue. But do read through #686, #528, and #606 first, at least.

I'm personally not against the idea, but if there's any more than one pass of string interpolation in your proposal, consider me out.

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

6 participants