From 3bd91b92ee0d71e0fd374678f5533cced7f23194 Mon Sep 17 00:00:00 2001 From: translatenix <119817707+translatenix@users.noreply.github.com> Date: Tue, 2 Apr 2024 11:14:43 -0700 Subject: [PATCH] Fix "amends declaration vs. expression" mistakes in language reference --- docs/modules/language-reference/pages/index.adoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/modules/language-reference/pages/index.adoc b/docs/modules/language-reference/pages/index.adoc index 570c6660..c70db327 100644 --- a/docs/modules/language-reference/pages/index.adoc +++ b/docs/modules/language-reference/pages/index.adoc @@ -655,7 +655,7 @@ Another difference is that in Pkl, object properties are late-bound. Read on to [[amends-declaration]] [NOTE] -.Amends expressions vs. amends declarations +.Amends declaration vs. amends expression ==== The <> and <> sections cover two notations that are both a form of amending; called an _amends declaration_ and an _amends expression_, respectively. @@ -671,16 +671,16 @@ parrot = (pigeon) { // <2> name = "Parrot" } ---- -<1> Amends expression. -<2> Amends declaration. +<1> Amends declaration. +<2> Amends expression. An amends declaration amends the property of the same name in a module's parent module, if the parent property exists. Otherwise, an amends declaration implicitly amends {uri-stdlib-Dynamic}[Dynamic]. Another way to think about an amends declaration is that it is shorthand for assignment. -In practical terms, `pigeon {}` is the same as `pigeon = super.pigeon {}`. +In practical terms, `pigeon {}` is the same as `pigeon = (super.pigeon) {}`. -Amending object bodies can be chained for both an amends expression and an amends declaration. +Amending object bodies can be chained for both an amends declaration and an amends expression. [source%tested,{pkl}] ---- @@ -696,8 +696,8 @@ dodo = (pigeon) { extinct = true } // <2> ---- -<1> Chained amends expression (`pigeon { ... } { ... }` is the amends expression). -<2> Chained amends declaration. +<1> Chained amends declaration. +<2> Chained amends expression (`(pigeon) { ... } { ... }` is the amends expression). ==== [[late-binding]]