Commit 38f0e4b6 authored by Marco Antoniotti's avatar Marco Antoniotti 💬
Browse files

Fixed typos.

parent 3a336e18
......@@ -21,9 +21,9 @@ collected within a WITH macro body. The methods of this class provide
more control over what happens with errors that may happen within
ENTER calls in non-straightforward contexts.
Notes;
Notes:
This class provides much of the functionalities displayed in the Pythn
This class provides much of the functionalities displayed in the Python
examples.
")
)
......
......@@ -12,7 +12,7 @@
;;;;
;;;; Solution one: we just build "state" objects.
;;;;
;;;; Other solutions are not feasable in Common Lisp given the lack of
;;;; Other solutions are not feasible in Common Lisp given the lack of
;;;; proper (delimited) continuations.
;;;;
;;;;
......@@ -42,13 +42,13 @@ examples in Common Lisp.")
(defgeneric is-managed-resource-context (x)
(:method ((x managed-resource-context)) t)
(:method ((x t)) nil)
(:documentation "Returns T if the argument X is a MANAGED-RESOURCE-CONTEXT."))
(:documentation
"Returns T if the argument X is a MANAGED-RESOURCE-CONTEXT."))
(defun managed-resource-context-p (x)
"Returns T if the argument X is a MANAGED-RESOURCE-CONTEXT.
Notes:
This function is a synonim of IS-MANAGED-RESOURCE-CONTEXT."
......@@ -57,20 +57,33 @@ This function is a synonim of IS-MANAGED-RESOURCE-CONTEXT."
;;; Constructor.
(defun managed-resaouce (id &key &allow-other-keys)
(defun managed-resource (id &key &allow-other-keys)
"Constructs a MANAGED-RESOURCE.
The only declared parameter, ID, should be a unique identified for the
resource."
(make-instance 'managed-resource-context :resource id)
)
;;;; ACQUIRE/RELEASE protocol.
(defgeneric acquire (mr &key)
(:method ((mr managed-resource-context) &key) mr))
(:method ((mr managed-resource-context) &key) mr)
(:documentation
"Acquires a MANAGED-RESOURCE.
This generic function is the 'entry' point of the ACQUIRE/RELEASE
protocol."))
(defgeneric release (mr &key)
(:method ((mr managed-resource-context) &key) mr))
(:method ((mr managed-resource-context) &key) mr)
(:documentation
"Releases a MANAGED-RESOURCE.
This generic function is the 'exit' point of the ACQUIRE/RELEASE
protocol."))
;;;; ENTER/HANDLE/EXIT protocol.
......@@ -83,7 +96,6 @@ This function is a synonim of IS-MANAGED-RESOURCE-CONTEXT."
(call-next-method) ; (error e)
)
(defmethod exit ((mr managed-resource-context) &key)
(release mr))
......
......@@ -3,7 +3,7 @@
;;;; with-open-file.lisp
;;;; The WITH macro working as WITH-OPEN-FILE.
;;;;
;;;; Note that this implementation is "direct". And "indirect" one
;;;; Note that this implementation is "direct". An "indirect" one
;;;; would wrap the stream in a NULL-CONTEXT; and this is what Python
;;;; appears to do with its decorator trick.
;;;; In Common Lisp we could to it either way; but the "direct" way
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment