Peter Bex scripsit:

> Here's a radical idea: How about removing the plain "pointer" type?  It
> can be implemented as a tagged pointer with a tag of whatever we like
> (for example #f).  It does mean that each and every pointer needs another
> word of storage, but most code doesn't rely on pointers very heavily
> anyway.

+1.  We added a word to symbols, which are much more common than pointers,
when we gave them p-lists, and nobody complained.  Tagged pointers are
useful because the tag gives them a Scheme-detectable type, so that you
can write:

(define (frob? obj)
  (and
    (tagged-pointer? obj)
    (eq? (pointer-tag obj) 'frob)))

and treat this subset of pointers just like any other Scheme type.
By contrast, tag-free pointers can't be safely introspected on, so
polymorphic code can't do anything with them.

-- 
John Cowan          http://www.ccil.org/~cowan        [email protected]
You know, you haven't stopped talking since I came here. You must
have been vaccinated with a phonograph needle.
        --Rufus T. Firefly

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to