mirror of
https://github.com/apple/pkl.git
synced 2026-03-19 15:54:24 +01:00
[docs] Document the class-as-a-function pattern (#614)
This commit is contained in:
@@ -2035,6 +2035,12 @@ greeting2 = greetPigeon(parrot) // <4>
|
||||
<3> Call instance method on `pigeon`.
|
||||
<4> Call module method (on `this`).
|
||||
|
||||
NOTE: Methods do not support named parameters or default parameter values.
|
||||
The xref:blog:ROOT:class-as-a-function.adoc[Class-as-a-function] pattern may be a suitable replacement.
|
||||
|
||||
TIP: In most cases, methods without parameters should not be defined.
|
||||
Instead, use <<fixed-properties,`fixed` properties>> on the module or class.
|
||||
|
||||
[[modules]]
|
||||
== Modules
|
||||
|
||||
@@ -5161,8 +5167,8 @@ It is defined by the presence of a `PklProject` file that amends the standard li
|
||||
Defining a project serves the following purposes:
|
||||
|
||||
1. It allows defining common evaluator settings for Pkl modules within a logical project.
|
||||
2. It helps with managing <<packages,package>> dependencies for Pkl modules within a logical project.
|
||||
3. It enables packaging and sharing the contents of the project as a <<packages,package>>.
|
||||
2. It helps with managing <<package-asset-uri,package>> dependencies for Pkl modules within a logical project.
|
||||
3. It enables packaging and sharing the contents of the project as a <<package-asset-uri,package>>.
|
||||
4. It allows importing packages via dependency notation.
|
||||
|
||||
[[project-dependencies]]
|
||||
|
||||
Reference in New Issue
Block a user