[r6rs-discuss] an essay on language design

From: John Cowan <cowan>
Date: Wed, 25 Jul 2007 10:00:12 -0400

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.
Received on Wed Jul 25 2007 - 10:00:12 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC