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

[Feature request] Array variables #1889

Open
gyreas opened this issue Feb 9, 2024 · 3 comments
Open

[Feature request] Array variables #1889

gyreas opened this issue Feb 9, 2024 · 3 comments

Comments

@gyreas
Copy link
Contributor

gyreas commented Feb 9, 2024

In Make, one can do something like val := ent1 ent2 ent3 ..., which Make will interpret as an array. Can we have something similar to it that'll also be compatible with variadic recipes and functions?

Bonus point for "post setting", eg

var := initial
# yada yada
var += additions
@casey
Copy link
Owner

casey commented Feb 11, 2024

I'd like this, but currently just only has string-valued variables, which makes things very simple, since you don't need to know the types of anything, and it's always guaranteed to be a string. We can't use += for arrays, because + is already the concatenation operator. Also, justfiles are order independent, so append can't work like that, since there's no sequential order to what's in a justfile.

I would like to have a general solution to this though. We already have * and + args, which are pretty hacky. One approach would be to make everything a list of strings, ala rc.

@ccxuy
Copy link

ccxuy commented Mar 14, 2024

How about considering add dictionary type variables?
Also, passing parameters to recipes are quite weird right now, I need to use just a=1 c=3 func when I need to skip some parameters as workaround in

a:=0
b:=0
c:=0
func a=a b=b c=c:

@casey
Copy link
Owner

casey commented Nov 8, 2024

I opened #2458 to track the possibility of making all values lists of strings.

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

Successfully merging a pull request may close this issue.

3 participants