Originally created by @LukasPrediger on GitHub (Apr 24, 2025).
Currently pkl is a pretty verbose language when writing simple constructs. It scales well but in the lowest regions i find myself writing a lot of extra code.
I think adding some syntax that allows for easier construction of primitive collections would already help.
Currently when i want to make a Listing of strings i have to write
foo = new Listing {
"a"
"b"
"c"
}
It would be much nicer to be able to just write foo = ["a", "b", "c"]
I don't know if there's already a function that allows me to something similar and i missed it but for now having to write a lot of extra code is my biggest downside of using pkl (which is otherwise a very good language for its usecase)
Originally created by @LukasPrediger on GitHub (Apr 24, 2025).
Currently pkl is a pretty verbose language when writing simple constructs. It scales well but in the lowest regions i find myself writing a lot of extra code.
I think adding some syntax that allows for easier construction of primitive collections would already help.
Currently when i want to make a Listing of strings i have to write
```
foo = new Listing {
"a"
"b"
"c"
}
```
It would be much nicer to be able to just write `foo = ["a", "b", "c"]`
I don't know if there's already a function that allows me to something similar and i missed it but for now having to write a lot of extra code is my biggest downside of using pkl (which is otherwise a very good language for its usecase)
Generally, you'd define a module that just describes your schema:
// MySchema.pkl
foo: Listing<String>
Then you'd define your data:
amends "MySchema.pkl"
foo {
"a"
"b"
"c"
}
In this case, adding = new Listing is redundant because you are already amending an empty listing.
@bioball commented on GitHub (Apr 24, 2025):
Generally, you'd define a module that just describes your schema:
```pkl
// MySchema.pkl
foo: Listing<String>
```
Then you'd define your data:
```pkl
amends "MySchema.pkl"
foo {
"a"
"b"
"c"
}
```
In this case, adding `= new Listing ` is redundant because you are already amending an empty listing.
I guess he is more asking about a syntax of creating a list in a single line. Like most programming language do.
So probably foo = new Listing { "a", "b", "c" }
would satisfy him.
But this is just not possible with pkl...
@StefMa commented on GitHub (Apr 24, 2025):
I guess he is more asking about a syntax of creating a list in a single line. Like most programming language do.
So probably
`foo = new Listing { "a", "b", "c" }`
would satisfy him.
But this is just not possible with pkl...
Semicolons can be used as element/entry/property separators for "inline" object bodies:
foo: Listing = new { "a"; "b"; "c" }
@HT154 commented on GitHub (Apr 24, 2025):
Semicolons can be used as element/entry/property separators for "inline" object bodies:
```
foo: Listing = new { "a"; "b"; "c" }
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @LukasPrediger on GitHub (Apr 24, 2025).
Currently pkl is a pretty verbose language when writing simple constructs. It scales well but in the lowest regions i find myself writing a lot of extra code.
I think adding some syntax that allows for easier construction of primitive collections would already help.
Currently when i want to make a Listing of strings i have to write
It would be much nicer to be able to just write
foo = ["a", "b", "c"]I don't know if there's already a function that allows me to something similar and i missed it but for now having to write a lot of extra code is my biggest downside of using pkl (which is otherwise a very good language for its usecase)
@bioball commented on GitHub (Apr 24, 2025):
Generally, you'd define a module that just describes your schema:
Then you'd define your data:
In this case, adding
= new Listingis redundant because you are already amending an empty listing.@StefMa commented on GitHub (Apr 24, 2025):
I guess he is more asking about a syntax of creating a list in a single line. Like most programming language do.
So probably
foo = new Listing { "a", "b", "c" }would satisfy him.
But this is just not possible with pkl...
@HT154 commented on GitHub (Apr 24, 2025):
Semicolons can be used as element/entry/property separators for "inline" object bodies:
@bioball commented on GitHub (May 7, 2025):
Closing this; the syntax is already pretty short, and not likely to change.