Pkl language preview
1. Application config
properties, types, and string interpolation
horizon-dark
name = "svelte-highlight"
version = "8.0.0"
server {
host = "0.0.0.0"
port = 8080
url = "http://\(host):\(port)"
}
environments = new Listing {
"development"
"staging"
"production"
} atom-one-dark
name = "svelte-highlight"
version = "8.0.0"
server {
host = "0.0.0.0"
port = 8080
url = "http://\(host):\(port)"
}
environments = new Listing {
"development"
"staging"
"production"
} github-dark
name = "svelte-highlight"
version = "8.0.0"
server {
host = "0.0.0.0"
port = 8080
url = "http://\(host):\(port)"
}
environments = new Listing {
"development"
"staging"
"production"
} dracula
name = "svelte-highlight"
version = "8.0.0"
server {
host = "0.0.0.0"
port = 8080
url = "http://\(host):\(port)"
}
environments = new Listing {
"development"
"staging"
"production"
} nord
name = "svelte-highlight"
version = "8.0.0"
server {
host = "0.0.0.0"
port = 8080
url = "http://\(host):\(port)"
}
environments = new Listing {
"development"
"staging"
"production"
} github
name = "svelte-highlight"
version = "8.0.0"
server {
host = "0.0.0.0"
port = 8080
url = "http://\(host):\(port)"
}
environments = new Listing {
"development"
"staging"
"production"
} 2. Classes and functions
class declarations and typed functions
horizon-dark
class Endpoint {
path: String
method: String = "GET"
}
function route(path: String): Endpoint = new Endpoint {
path = path
}
routes {
["health"] = route("/health")
["users"] = route("/api/users")
} atom-one-dark
class Endpoint {
path: String
method: String = "GET"
}
function route(path: String): Endpoint = new Endpoint {
path = path
}
routes {
["health"] = route("/health")
["users"] = route("/api/users")
} github-dark
class Endpoint {
path: String
method: String = "GET"
}
function route(path: String): Endpoint = new Endpoint {
path = path
}
routes {
["health"] = route("/health")
["users"] = route("/api/users")
} dracula
class Endpoint {
path: String
method: String = "GET"
}
function route(path: String): Endpoint = new Endpoint {
path = path
}
routes {
["health"] = route("/health")
["users"] = route("/api/users")
} nord
class Endpoint {
path: String
method: String = "GET"
}
function route(path: String): Endpoint = new Endpoint {
path = path
}
routes {
["health"] = route("/health")
["users"] = route("/api/users")
} github
class Endpoint {
path: String
method: String = "GET"
}
function route(path: String): Endpoint = new Endpoint {
path = path
}
routes {
["health"] = route("/health")
["users"] = route("/api/users")
} 3. Interpolation with nested calls
a \(...) interpolation containing its own function call
horizon-dark
local tags = List("core", "docs", "themes")
summary = "tags: \(tags.join(", "))" atom-one-dark
local tags = List("core", "docs", "themes")
summary = "tags: \(tags.join(", "))" github-dark
local tags = List("core", "docs", "themes")
summary = "tags: \(tags.join(", "))" dracula
local tags = List("core", "docs", "themes")
summary = "tags: \(tags.join(", "))" nord
local tags = List("core", "docs", "themes")
summary = "tags: \(tags.join(", "))" github
local tags = List("core", "docs", "themes")
summary = "tags: \(tags.join(", "))" 4. Triple-quoted pound strings and annotations
a #"""..."""# string and a dotted @annotation
horizon-dark
@modulepath.Deprecated { message = "use v2 instead" }
class LegacyConfig {
template = #"""
Use \#(name) with caution.
Braces like {this} are literal here.
"""#
} atom-one-dark
@modulepath.Deprecated { message = "use v2 instead" }
class LegacyConfig {
template = #"""
Use \#(name) with caution.
Braces like {this} are literal here.
"""#
} github-dark
@modulepath.Deprecated { message = "use v2 instead" }
class LegacyConfig {
template = #"""
Use \#(name) with caution.
Braces like {this} are literal here.
"""#
} dracula
@modulepath.Deprecated { message = "use v2 instead" }
class LegacyConfig {
template = #"""
Use \#(name) with caution.
Braces like {this} are literal here.
"""#
} nord
@modulepath.Deprecated { message = "use v2 instead" }
class LegacyConfig {
template = #"""
Use \#(name) with caution.
Braces like {this} are literal here.
"""#
} github
@modulepath.Deprecated { message = "use v2 instead" }
class LegacyConfig {
template = #"""
Use \#(name) with caution.
Braces like {this} are literal here.
"""#
}