Can I set a pkl property value outside of an object declaration? #310
Answered
by
bioball
ericzbeard
asked this question in
Q&A
-
Is there a syntax for doing this in pkl? The following fails: class Foo {
Bar: String
}
f = Foo {
Bar = "Baz"
}
f.Bar = "Something else"
output {
value = f
}
I also can't set a property value within a class method. |
Beta Was this translation helpful? Give feedback.
Answered by
bioball
Mar 11, 2024
Replies: 1 comment 2 replies
-
No; Pkl values are immutable, and there are also no statements in Pkl. You can express another object that is derived from class Foo {
Bar: String
}
f = new Foo {
Bar = "Baz"
}
g = (f) {
Bar = "Something else"
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ericzbeard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No; Pkl values are immutable, and there are also no statements in Pkl.
You can express another object that is derived from
f
using object amending: