You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/compiler.rst
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,6 +177,16 @@ Functions not meeting these criteria will trigger compile time errors if they ar
177
177
178
178
Users should consider inlining primarily a Basilisp internal feature and use it extremely sparingly in user code.
179
179
180
+
.. warning::
181
+
182
+
Due to the nature of how inline functions are applied, there is a potential for name clashes between the inline function parameter names and names defined elsewhere in the containing Python module.
183
+
Therefore, it is recommended for any inline function to set the meta key ``^:safe-py-params`` to ensure that the compiler generates globally unique Python parameter names.
184
+
For inline functions generated automatically by the compiler, this setting is automatically enabled.
Copy file name to clipboardExpand all lines: docs/pyinterop.rst
+2-10Lines changed: 2 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,14 +22,6 @@ When compiled, a ``kebab-case`` identifier always becomes a ``snake_case`` ident
22
22
23
23
The Basilisp compiler munges *all* unsafe Basilisp identifiers to safe Python identifiers, but other cases are unlikely to appear in standard Python interop usage.
24
24
25
-
.. note::
26
-
27
-
By default, the compiler munges function parameter names and makes them globally unique by appending a monotically increasing number suffix to support function inlining. To enable interop with Python libraries that rely on preserved parameter names, you can use the ```^:allow-unsafe-names`` metadata key to retain the (munged) parameter names. This flag only applies to single-arity Basilisp functions.
28
-
29
-
.. code-block::
30
-
31
-
(defn ^:allow-unsafe-names afun [a b] ...)
32
-
33
25
.. _python_builtins:
34
26
35
27
Python Builtins
@@ -316,7 +308,7 @@ These decorators are applied from right to left, similar to how Python decorator
316
308
;;; Decorators with arguments, and order of application (right to left)
317
309
;;
318
310
;; example decorator
319
-
(defn mult-x-decorator
311
+
(defn mult-x-decorator
320
312
[x]
321
313
(fn [f]
322
314
(fn [] (* (f) x))))
@@ -327,7 +319,7 @@ These decorators are applied from right to left, similar to how Python decorator
0 commit comments