Why newExpr
requires new
keyword?
#419
Replies: 3 comments 15 replies
-
Most of the |
Beta Was this translation helpful? Give feedback.
-
Yes, I know but I'd like to use the same assignment notation like below. foo = 1
bar = { baz = 1 } In addition, an foo { 0 new { bar = 1 } } // Need new keyword
baz { 2 { qux = 3 } } // I'd like to write like this |
Beta Was this translation helpful? Give feedback.
-
In Pkl, object bodies always amend something. class Person {
name: String
birthday: String
}
people = new Listing<Person> {
default { name = "Ellis" }
new { birthday = "2020/01/01" }
} Here, the Simply using people = new Listing<Person> {
default { name = "Ellis" };
{ birthday = "2020/01/01" }
} There's also a grammar ambiguity here; this is parsed as a chained amends expression myObj {
(foo) {}
{}
{}
{}
} |
Beta Was this translation helpful? Give feedback.
-
I have a question about
newExpr
.I'm using
YAML
as the input format of my app like this and tring to rewrite it by using Pkl.https://github.com/rggen/rggen-sample/blob/master/uart_csr.yml
This is the result.
This trial led me to think that
{}
blocks without new keyword looks better.Is there any reason why the
newExpr
requires thenew
keyword?Beta Was this translation helpful? Give feedback.
All reactions