Skip to content

Commit f66d553

Browse files
committed
elaborate docstring
1 parent d01da3b commit f66d553

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

unpythonic/lazyutil.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,32 @@ def passthrough_lazy_args(f):
7070
`maybe_force_args` to make the actual call, so that the call target is
7171
also checked for this mark.)
7272
73-
***CAUTION***: The mark is implemented as an attribute on the function
73+
**CAUTION**: The mark is implemented as an attribute on the function
7474
object. Hence, if the result is wrapped by another decorator, the mark
7575
won't be active on the final decorated function.
7676
7777
The exact position where you want this in the decorator list depends
7878
on what exactly you're doing - the priority is set to `95` to make this
7979
apply before `curry`, so that `curry` will see the mark.
80+
81+
**NOTE**: Conceptually, an argument having the passthrough-only property
82+
is closely related to parametric polymorphism. A function that just passes
83+
through an argument to another function, without accessing it, usually is
84+
parametric (in the polymorphism sense) in that argument. See the
85+
introduction of:
86+
87+
Arjun Guha, Jacob Matthews, Robert Bruce Findler, Shriram Krishnamurthi 2007:
88+
Relationally-Parametric Polymorphic Contracts
89+
http://cs.brown.edu/~sk/Publications/Papers/Published/gmfk-rel-par-poly-cont/
90+
91+
For simplicity, this decorator assumes blanket parametricity - i.e. the
92+
decorated function *could* be parametric in *all* of its arguments. however,
93+
it is not the role of this decorator to guarantee anything about parametricity.
94+
This is an implementation detail that says "treat this function as if it could
95+
be parametric in any or all of its arguments".
96+
97+
It is then the responsibility of the decorated function to force those arguments
98+
it actually needs to access (i.e., not just pass through).
8099
"""
81100
f._passthrough_lazy_args = True
82101
return f

0 commit comments

Comments
 (0)