[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
289/376: Document functors
From: |
Ludovic Courtès |
Subject: |
289/376: Document functors |
Date: |
Wed, 28 Jan 2015 22:05:41 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 3d604ac88c81dd9b22252c7437a717b077897b13
Author: Shea Levy <address@hidden>
Date: Wed Oct 15 22:32:08 2014 -0400
Document functors
---
doc/manual/expressions/language-constructs.xml | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/doc/manual/expressions/language-constructs.xml
b/doc/manual/expressions/language-constructs.xml
index ddb3498..74809bb 100644
--- a/doc/manual/expressions/language-constructs.xml
+++ b/doc/manual/expressions/language-constructs.xml
@@ -196,6 +196,24 @@ in concat { x = "foo"; y = "bar"; }</programlisting>
</para>
+<para>A set that has a <literal>__functor</literal> attribute whose value
+is callable (i.e. is itself a function or a set with a
+<literal>__functor</literal> attribute whose value is callable) can be
+applied as if it were a function, with the set itself passed in first
+, e.g.,
+
+<programlisting>
+let add = { __functor = self: x: x + self.x; };
+ inc = add // { x = 1; };
+in inc 1
+</programlisting>
+
+evaluates to <literal>2</literal>. This can be used to attach metadata to a
+function without the caller needing to treat it specially, or to implement
+a form of object-oriented programming, for example.
+
+</para>
+
</simplesect>
- 275/376: Revert "Revert "Revert "Temporarily disable darwin builds while hydra's darwin is borked""", (continued)
- 275/376: Revert "Revert "Revert "Temporarily disable darwin builds while hydra's darwin is borked""", Ludovic Courtès, 2015/01/28
- 302/376: Don't claim FreeBSD support, Ludovic Courtès, 2015/01/28
- 274/376: Don't pull in git when doing a nix-shell, Ludovic Courtès, 2015/01/28
- 247/376: mkList: Scrub better, Ludovic Courtès, 2015/01/28
- 248/376: Improved error message when encountering unsupported file types, Ludovic Courtès, 2015/01/28
- 295/376: nix-daemon: Call exit(), not _exit(), Ludovic Courtès, 2015/01/28
- 242/376: Add primop ‘attrValues’, Ludovic Courtès, 2015/01/28
- 254/376: nix-store -q: Check for conflicting flags, Ludovic Courtès, 2015/01/28
- 265/376: Merge pull request #380 from shlevy/temp-disable-darwin, Ludovic Courtès, 2015/01/28
- 253/376: nix-channel: Add --rollback flag, Ludovic Courtès, 2015/01/28
- 289/376: Document functors,
Ludovic Courtès <=
- 259/376: Export realiseContext in libnixexpr, Ludovic Courtès, 2015/01/28
- 284/376: SSH.pm: Print a friendlier message if connecting fails, Ludovic Courtès, 2015/01/28
- 278/376: Typo, Ludovic Courtès, 2015/01/28
- 292/376: Add a test for the binary tarball installer, Ludovic Courtès, 2015/01/28
- 296/376: Disable vacuuming the DB after garbage collection, Ludovic Courtès, 2015/01/28
- 298/376: Fix bad operator, Ludovic Courtès, 2015/01/28
- 270/376: Revert "Temporarily disable darwin builds while hydra's darwin is borked", Ludovic Courtès, 2015/01/28
- 283/376: Doh, Ludovic Courtès, 2015/01/28
- 300/376: import derivation: cleanup, Ludovic Courtès, 2015/01/28
- 264/376: Temporarily disable darwin builds while hydra's darwin is borked, Ludovic Courtès, 2015/01/28