aboutsummaryrefslogtreecommitdiffstats
path: root/info/join-python.texinfo
diff options
context:
space:
mode:
Diffstat (limited to 'info/join-python.texinfo')
-rw-r--r--info/join-python.texinfo37
1 files changed, 36 insertions, 1 deletions
diff --git a/info/join-python.texinfo b/info/join-python.texinfo
index df311eb..8d27320 100644
--- a/info/join-python.texinfo
+++ b/info/join-python.texinfo
@@ -54,7 +54,8 @@ Texts. A copy of the license is included in the section entitled
* Signals:: The signal construct.
* Fragments:: The fragment join construct.
* Join-switches:: Advanced joining techniques.
-* Fork–merge:: Running multiple functions concurrently synchronously
+* Fork–merge:: Running multiple functions concurrently synchronously.
+* Working with Classes:: Support for classes.
* GNU Free Documentation License:: Copying and sharing this manual.
@end menu
@@ -308,6 +309,40 @@ In parallel
+@node Working with Classes
+@chapter Working with Classes
+
+If a signal or fragment is a part of a class, it is
+automatically made into a static function. To make a
+function into an instance function or instance method,
+you need to decorate it with @code{@@joinmethod}.
+
+@cartouche
+@example
+>>> from join import *
+>>>
+>>> class Class:
+>>> def __init__(self, value):
+>>> self.value = value
+>>>
+>>> @@joinmethod
+>>> @@fragment
+>>> def fi(self):
+>>> return self.value ** 3
+>>>
+>>> @@fragment
+>>> def fs(value):
+>>> return value ** 3
+>>>
+>>> Class.fs(2)
+8
+>>> Class(2).fi()
+8
+@end example
+@end cartouche
+
+
+
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include fdl.texinfo