Skip to content

Commit cd4962f

Browse files
committed
Update readme
1 parent 0e1e0f8 commit cd4962f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ Even more usefully, we don’t have to worry about bugs caused by misspellings:
430430

431431
## Defer, scope guards, and RAII
432432

433+
A common complaint about writing code with C FFIs is that it forces you to write C in Lisp. It would be useful to have a paradigm available which, while not as safe as automatic memory management, makes manual memory management safer.
434+
433435
Some programming languages provide a way to register code to run later. Typically the programmer registers how to release a resource at the time the resource is allocated. Some languages provide this feature along lexical scopes using special syntax (Go’s and Zig’s `defer`, D’s `scope_guard`) and other languages (C++, Rust) provide it along lifetimes (what Lisp calls “extents”) but limit it to objects with special methods (C++ RAII, Rust `Drop`).
434436

435437
Serapeum’s implementation looks like the Go/Zig/D style:
@@ -443,7 +445,7 @@ Serapeum’s implementation looks like the Go/Zig/D style:
443445
))
444446
```
445447

446-
Serapeum scope guards, however, are tied to *dynamic extent* (lifetime) rather than *lexical scope*, so they implement the full generality of RAII. The deferred call does not have to be in the lexical extent of `with-defer`:
448+
Serapeum scope guards, however, are tied to *dynamic extent* (lifetime) rather than *lexical scope*, so they implement the full generality of RAII. The deferred call does not have to be in the lexical scope of `with-defer`:
447449

448450
``` lisp
449451
(defun open-managed-file (&rest args)

0 commit comments

Comments
 (0)