Skip to content

Commit e9c3d55

Browse files
committed
Remove strong context dependency from force function.
1 parent 4fa9720 commit e9c3d55

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Sources/LispKit/Data/Procedure.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ public final class Procedure: Reference, CustomStringConvertible {
8787
public init(_ name: String,
8888
_ compiler: @escaping FormCompiler,
8989
in context: Context) {
90-
func indirect(_ args: Arguments) throws -> Code {
91-
let expr =
92-
Expr.pair(
93-
.symbol(Symbol(context.symbols.intern(name), context.global)),
94-
.makeList(args))
95-
return try Compiler.compile(expr: .pair(expr, .null),
96-
in: context.global,
97-
optimize: true)
98-
}
99-
self.kind = .primitive(name, .eval(indirect), compiler)
90+
self.kind = .primitive(name, .eval(
91+
{ [unowned context] (args: Arguments) throws -> Code in
92+
let expr =
93+
Expr.pair(
94+
.symbol(Symbol(context.symbols.intern(name), context.global)),
95+
.makeList(args))
96+
return try Compiler.compile(expr: .pair(expr, .null),
97+
in: context.global,
98+
optimize: true)
99+
}), compiler)
100100
}
101101

102102
/// Initializer for primitive applicators

0 commit comments

Comments
 (0)