commit 294e3337bbc7b3505f45b9d951ec53b7d6f648ca
parent f736d10d219843e0c77a74bb807fb194c1bb200d
Author: Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
Date: Fri, 14 Aug 2015 10:40:05 +0200
Update README.
Diffstat:
M | README.md | | | 30 | +++++++++++++++++++++++++++--- |
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -18,11 +18,11 @@ So, assuming `hashtable` has no entry for `"foo"`:
- `(ref hashtable "foo" 'default)` => `default`
- `(ref hashtable "foo")` => error
-That's all.
+That's all for starters.
-Details
--------
+Library usage details
+---------------------
One needs to exclude `set!` and `define-record-type` when importing
`(scheme base)`, and import them from this library instead. (One
@@ -32,6 +32,30 @@ course the intent is that Scheme implementations provide these
extended `set!` and `define-record-type` in their `(scheme base)` so
this problem won't apply.
+
+SRFI-17 and SRFI-105 integration
+--------------------------------
+
+`set!` is the setter of `ref` in SRFI-17 terms, so `(set! (ref object
+field) value)` works. This is not useful on its own, but becomes
+useful in combination with SRFI-105. `ref` is also exported as
+`$bracket-apply$`, so e.g. `(set! {object[field]} value)` works. That
+is still not an improvement over the normal `(set! object field
+value)`, however if one also imports e.g. `:=` as a synonym for
+`set!`, one can use some very "C-like" syntax: `{object[field] :=
+value}`.
+
+I strongly discourage use of that syntax in code which *otherwise*
+doesn't heavily utilize SRFI-105 syntax. The normal `(set! object
+field value)` fits in much more nicely with typical Scheme code.
+However, if you already use SRFI-105 syntax heavily in your code, then
+the `{object[field] := value}` syntax is likely to be a welcome
+addition.
+
+
+Overhead
+--------
+
Overhead while defining record types should be generally irrelevant to
an application (why would you be defining record types during a
bottleneck?); the overhead inherent to `ref` and `set!` might also