Skip to content

Commit 9eaa4c7

Browse files
committed
terminology and wording fixes
1 parent 9384277 commit 9eaa4c7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

doc/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3135,7 +3135,7 @@ Based on my own initial experiments with this feature, the machinery itself work
31353135
31363136
The machinery itself is also missing some advanced features, such as matching the most specific multimethod candidate instead of the most recently defined one; an `issubclass` equivalent that understands `typing` type specifications; and a mechanism to remove previously declared multimethods.
31373137
3138-
**CAUTION**: Multiple dispatch can be dangerous. Particularly, `@augment` can be dangerous to the readability of your codebase. If methods are added for a generic function defined elsewhere, for types defined elsewhere, this may lead to [*spooky action at a distance*](https://lexi-lambda.github.io/blog/2016/02/18/simple-safe-multimethods-in-racket/) (as in [action at a distance](https://en.wikipedia.org/wiki/Action_at_a_distance_(computer_programming))). In the Julia community, this is known as [*type piracy*](https://docs.julialang.org/en/v1/manual/style-guide/#Avoid-type-piracy). Keep in mind that the multiple-dispatch table is global state!
3138+
**CAUTION**: Multiple dispatch can be dangerous. Particularly, `@augment` can be dangerous to the readability of your codebase. If a new multimethod is added for a generic function defined elsewhere, for types defined elsewhere, this may lead to [*spooky action at a distance*](https://lexi-lambda.github.io/blog/2016/02/18/simple-safe-multimethods-in-racket/) (as in [action at a distance](https://en.wikipedia.org/wiki/Action_at_a_distance_(computer_programming))). In the Julia community, this is known as [*type piracy*](https://docs.julialang.org/en/v1/manual/style-guide/#Avoid-type-piracy). Keep in mind that the multiple-dispatch table is global state!
31393139
31403140
31413141
#### ``typed``: add run-time type checks with type annotation syntax

unpythonic/dispatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def _list_multimethods(dispatcher, self_or_cls=None):
420420
relevant_registries = [reversed(dispatcher._method_registry)]
421421

422422
# But if this dispatcher is installed on a method, we must
423-
# look up generic function methods also in the class's MRO.
423+
# look up multimethods also in the class's MRO.
424424
#
425425
# For *static methods* MRO is not supported. Basically, one of
426426
# the roles of `cls` or `self` is to define the MRO; a static

unpythonic/tests/test_dispatch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ def instmeth(self, x: float):
201201
return f"floating with {self.a * x}"
202202

203203
tt2 = BabyTestTarget(3)
204-
# the new generic-function methods become available, installed on the OOP method
204+
# the new multimethods become available, installed on the OOP method
205205
test[tt2.instmeth(3.14) == "floating with 9.42"]
206-
# old generic-function methods registered by the ancestor remain available
206+
# old multimethods registered by the ancestor remain available
207207
test[tt2.instmeth("hi") == "hi hi hi"]
208208
test[tt2.instmeth(21) == 63]
209209
test[tt2.clsmeth(3.14) == "Test target floats: 6.28"]

0 commit comments

Comments
 (0)