guile-srfi-123

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit fc57f5e766d5f7eb0600547dd7a0e3c6df7dd0ed
parent b2e6a0b46b719e56f0965688df2f798a1932bc07
Author: Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
Date:   Sat, 15 Aug 2015 13:10:20 +0200

Clarify our delegation of error reporting.

Diffstat:
MREADME.md | 5++++-
MSRFI.html | 3++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -154,7 +154,10 @@ Returns the value for `field` in `object`. If `object` is of a (e.g. a hashtable), and the requested field is empty, then the value of `default` is returned if given, and otherwise an error raised. If `object` is not of a sparse type, then `default` is ignored and an -error raised if object doesn't have a value for `field`. +error raised if object doesn't have a value for `field`. (This error +will typically come from the underlying accessor procedure.) + + (ref #(0 1 2) 3) ;error: vector-ref: Index out of bounds. Valid types for `object` are: bytevectors, hashtables, pairs, strings, vectors, and all record types. Only hashtables are a sparse type. diff --git a/SRFI.html b/SRFI.html @@ -66,7 +66,8 @@ <li><code>(ref object field)</code> (procedure)</li> <li><code>(ref object field default)</code></li> </ul> -<p>Returns the value for <code>field</code> in <code>object</code>. If <code>object</code> is of a &quot;sparse&quot; type, meaning its fields can be &quot;empty&quot; or &quot;unassigned&quot; (e.g. a hashtable), and the requested field is empty, then the value of <code>default</code> is returned if given, and otherwise an error raised. If <code>object</code> is not of a sparse type, then <code>default</code> is ignored and an error raised if object doesn't have a value for <code>field</code>.</p> +<p>Returns the value for <code>field</code> in <code>object</code>. If <code>object</code> is of a &quot;sparse&quot; type, meaning its fields can be &quot;empty&quot; or &quot;unassigned&quot; (e.g. a hashtable), and the requested field is empty, then the value of <code>default</code> is returned if given, and otherwise an error raised. If <code>object</code> is not of a sparse type, then <code>default</code> is ignored and an error raised if object doesn't have a value for <code>field</code>. (This error will typically come from the underlying accessor procedure.)</p> +<pre><code>(ref #(0 1 2) 3) ;error: vector-ref: Index out of bounds.</code></pre> <p>Valid types for <code>object</code> are: bytevectors, hashtables, pairs, strings, vectors, and all record types. Only hashtables are a sparse type. Implementations are encouraged to expand this list of types with any non-standard types they support.</p> <p>Valid types for <code>field</code> depend on the type of <code>object</code>. For bytevectors, hashtables, strings, and vectors, refer to their respective <code>*-ref</code> procedures. For pairs, refer to <code>list-ref</code>. For records, symbols that correspond with the record type's field names are allowed.</p> <p>If SRFI-17 is supported, then the <code>ref</code> procedure has the following setter: <code>(lambda (object field value) (set! object field value))</code></p>