[r6rs-discuss] an essay on language design

John Cowan cowan at ccil.org
Wed Jul 25 10:00:12 EDT 2007


John Tobey scripsit:

> Scheme already has an encapsulation mechanism: closures!  It should be
> "(<type> 'make) ((obj 'is-a?) <type>) (obj 'field)" and either "(set!
> (obj 'field) value)" or "((obj 'set!) 'field value)" according to
> your tastes.

The problem is that ((obj 'is-a?) foo) returns undefined results if
obj is not an object, whereas it can be guaranteed that the (foo? obj)
generated by a record library returns #f if obj is not a foo.

Furthermore, if obj is a closure not being used to represent an object,
one may get a false positive from (obj 'is-a), e.g. if obj is symbol?.

No, the irreplaceable thing about records, no matter how you slice it,
is their ability to create novel disjoint types.

-- 
My corporate data's a mess!                     John Cowan
It's all semi-structured, no less.              http://www.ccil.org/~cowan
    But I'll be carefree                        cowan at ccil.org
    Using XSLT
On an XML DBMS.



More information about the r6rs-discuss mailing list