[docs] Document the class-as-a-function pattern (#614)

This commit is contained in:
Josh B
2024-08-15 17:06:56 -07:00
committed by GitHub
parent e21db76efe
commit a9c4963a4a

View File

@@ -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]]