Hi, On Sat 17 Apr 2010 22:48, l...@gnu.org (Ludovic Courtès) writes:
> Clinton Ebadi <clin...@unknownlamer.org> writes: > >> I talked to wingo, and he suggested that (equal? WEAK-VECTOR VECTOR) => >> #f; > > Hmm what’s the motivation? It seems more intuitive to me to have, e.g., > > (equal? (make-vector 3 4) (make-weak-vector 3 4)) > => #t Because these have different tc7's, but they were arrays, this comparison happened via the array handle mechanism; but the array handle implementation wasn't quite right. So perhaps the proper fix is to keep weak vectors as being arrays, so they can be equal? to vectors, but fix up their implementation, to something like this: static SCM weak_vector_handle_ref (scm_t_array_handle *h, size_t idx) { return scm_c_vector_ref (h->array, idx); } static void weak_vector_handle_set (scm_t_array_handle *h, size_t idx, SCM val) { scm_c_vector_set_x (h->array, idx, val); } static void weak_vector_get_handle (SCM v, scm_t_array_handle *h) { h->array = v; h->ndims = 1; h->dims = &h->dim0; h->dim0.lbnd = 0; h->dim0.ubnd = scm_c_vector_length (v) - 1; h->dim0.inc = 1; h->element_type = SCM_ARRAY_ELEMENT_TYPE_SCM; h->elements = h->writable_elements = NULL; /* disallow direct access */ } SCM_ARRAY_IMPLEMENTATION (scm_tc7_wvect, 0x7f, weak_vector_handle_ref, weak_vector_handle_set, weak_vector_get_handle) Clinton can you try this one? Andy -- http://wingolog.org/