mirror of
https://github.com/apple/pkl.git
synced 2026-03-20 16:23:57 +01:00
@@ -22,7 +22,7 @@ At the same time, anyone configuring your application -- whether that's your use
|
||||
+
|
||||
At the time of writing, Pkl offers configuration libraries for the JVM runtime, Swift, and also for Golang.
|
||||
+
|
||||
We maintian the following libraries:
|
||||
We maintain the following libraries:
|
||||
+
|
||||
* xref:java-binding:pkl-config-java.adoc[pkl-config-java] for Java compatible languages
|
||||
* xref:kotlin-binding:pkl-config-kotlin.adoc[pkl-config-kotlin] for the {uri-kotlin-homepage}[Kotlin] language.
|
||||
|
||||
@@ -103,7 +103,7 @@ To run the CLI, execute the library Jar or its `org.pkl.codegen.kotlin.Main` mai
|
||||
*Synopsis:* `java -cp <classpath> -jar pkl-codegen-kotlin.jar [<options>] <modules>`
|
||||
|
||||
`<modules>`::
|
||||
The absolute or relative URIs of the modules to generate classe for.
|
||||
The absolute or relative URIs of the modules to generate classes for.
|
||||
Relative URIs are resolved against the working directory.
|
||||
|
||||
==== Options
|
||||
|
||||
@@ -269,7 +269,7 @@ Floats support the same comparison and arithmetic operators as integers.
|
||||
Float literals with zero fractional part can be safely replaced with integer literals.
|
||||
For example, it is safe to write `1.3 * 42` instead of `1.3 * 42.0`.
|
||||
|
||||
Floats can also include the same underscore separater as integers. For example, `1_000.4_400` is a float whose value is equivalent to `1000.4400`.
|
||||
Floats can also include the same underscore separator as integers. For example, `1_000.4_400` is a float whose value is equivalent to `1000.4400`.
|
||||
|
||||
TIP: As integers are more convenient to use than floats with zero fractional part, we recommend to require `x: Number` instead of `x: Float` in type annotations.
|
||||
|
||||
@@ -3363,7 +3363,7 @@ list3 = List(1, "x", 5.min, List(1, 2, 3)) // <3>
|
||||
----
|
||||
<1> result: empty list
|
||||
<2> result: list of length 3
|
||||
<3> result: heterogenous list whose last element is another list
|
||||
<3> result: heterogeneous list whose last element is another list
|
||||
|
||||
To concatenate lists, use the `+` operator:
|
||||
|
||||
@@ -3420,7 +3420,7 @@ res4 = Set(1, "x", 5.min, List(1, 2, 3)) // <4>
|
||||
<1> result: empty set
|
||||
<2> result: set of length 3
|
||||
<3> result: same set of length 3
|
||||
<4> result: heterogenous set that contains a list as its last element
|
||||
<4> result: heterogeneous set that contains a list as its last element
|
||||
|
||||
To compute the union of sets, use the `+` operator:
|
||||
|
||||
@@ -3836,7 +3836,7 @@ More complex union types can be formed:
|
||||
foo: List<Boolean|Number|String>|Bird
|
||||
----
|
||||
|
||||
Union types have no implicit default values, but an explicit type can be choosen using a `*` marker:
|
||||
Union types have no implicit default values, but an explicit type can be chosen using a `*` marker:
|
||||
[source%parsed,{pkl}]
|
||||
----
|
||||
foo: "a"|"b" // undefined. Will throw an error if not amended
|
||||
@@ -3997,7 +3997,7 @@ pigeon: Bird = new {
|
||||
----
|
||||
<1> Restricts `name` to have at least three characters.
|
||||
<2> The name of the bird (`this`) should not be the same as the name of the `parent`.
|
||||
<3> Note how `parent` is different from `name`. If they were the same, we would be thrown a contraint error.
|
||||
<3> Note how `parent` is different from `name`. If they were the same, we would be thrown a constraint error.
|
||||
|
||||
In the following example, we define a `Bird` with a name of only two characters.
|
||||
|
||||
@@ -5024,7 +5024,7 @@ To answer this question, Pkl follows these steps:
|
||||
If a match is found, this is the answer.
|
||||
. Search the `pkl.base` module for a top-level definition of method `x`.
|
||||
If a match is found, this is the answer.
|
||||
. Seach the class inheritance chain of `this`, starting with the class of `this`
|
||||
. Search the class inheritance chain of `this`, starting with the class of `this`
|
||||
and continuing upwards until and including class `Any`, for a method named `x.`
|
||||
If a match is found, this is the answer.
|
||||
. Throw a "method `x` not found" error.
|
||||
|
||||
@@ -366,7 +366,7 @@ This command also takes <<common-options, common options>>.
|
||||
[[command-server]]
|
||||
=== `pkl server`
|
||||
|
||||
*Synopsys:* `pkl server`
|
||||
*Synopsis:* `pkl server`
|
||||
|
||||
Run as a server that communicates over standard input/output.
|
||||
|
||||
@@ -375,7 +375,7 @@ This option is used for embedding Pkl in an external client, such as xref:swift:
|
||||
[[command-test]]
|
||||
=== `pkl test`
|
||||
|
||||
*Synopsys:* `pkl test [<options>] [<modules>]`
|
||||
*Synopsis:* `pkl test [<options>] [<modules>]`
|
||||
|
||||
Evaluate the given `<modules>` as _tests_, producing a test report and appropriate exit code.
|
||||
|
||||
@@ -410,7 +410,7 @@ This command also takes <<common-options, common options>>.
|
||||
[[command-repl]]
|
||||
=== `pkl repl`
|
||||
|
||||
*Synopsys:* `pkl repl [<options>]`
|
||||
*Synopsis:* `pkl repl [<options>]`
|
||||
|
||||
Start a REPL session.
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ The cache directory for storing packages.
|
||||
.--no-cache
|
||||
[%collapsible]
|
||||
====
|
||||
Disable cacheing of packages.
|
||||
Disable caching of packages.
|
||||
====
|
||||
|
||||
.-e, --env-var
|
||||
|
||||
@@ -626,7 +626,7 @@ Default: `false` +
|
||||
Whether to ignore expected example files and generate them again.
|
||||
====
|
||||
|
||||
Common propeties:
|
||||
Common properties:
|
||||
|
||||
include::../partials/gradle-common-properties.adoc[]
|
||||
|
||||
@@ -688,6 +688,6 @@ Example: `projectDirectories.from(file("pkl-config/""))` +
|
||||
The project directories to create packages for.
|
||||
====
|
||||
|
||||
Common propeties:
|
||||
Common properties:
|
||||
|
||||
include::../partials/gradle-common-properties.adoc[]
|
||||
|
||||
@@ -72,7 +72,7 @@ If `null`, defaults to `~/.pkl/cache`.
|
||||
[%collapsible]
|
||||
====
|
||||
Default: `false` +
|
||||
Disable cacheing of packages.
|
||||
Disable caching of packages.
|
||||
====
|
||||
|
||||
.modulePath: ConfigurableFileCollection
|
||||
|
||||
@@ -254,7 +254,7 @@ myFoo1: Foo = new Foo { foo = "bar" } // <1>
|
||||
myFoo2 = new Foo { foo = "bar" } // <2>
|
||||
----
|
||||
<1> Unnecessary `new Foo { ... }`
|
||||
<2> Unless amending/extendinge a module where `myFoo2` is already defined, `myFoo2` is effectively the `unknown` type, i.e. `myFoo2: unknown`.
|
||||
<2> Unless amending/extending a module where `myFoo2` is already defined, `myFoo2` is effectively the `unknown` type, i.e. `myFoo2: unknown`.
|
||||
|
||||
== Comments
|
||||
|
||||
@@ -270,7 +270,7 @@ Add a single space after `///`.
|
||||
|
||||
[source%parsed,{pkl}]
|
||||
----
|
||||
/// The time alotted for eating lunch.
|
||||
/// The time allotted for eating lunch.
|
||||
///
|
||||
/// Note:
|
||||
/// * Hamburgers typically take longer to eat than salad.
|
||||
@@ -300,7 +300,7 @@ A line comment may also be placed at the end of a line, as long as the line does
|
||||
[source%tested,{pkl}]
|
||||
----
|
||||
/// Designates whether it is zebra party time.
|
||||
partyTime: Booleean // TODO: Add constraints here?
|
||||
partyTime: Boolean // TODO: Add constraints here?
|
||||
----
|
||||
|
||||
=== Block comments
|
||||
|
||||
Reference in New Issue
Block a user