[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] coops, instance-of?
From: |
John J Foerch |
Subject: |
Re: [Chicken-hackers] coops, instance-of? |
Date: |
Mon, 13 Jun 2016 16:20:22 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Kon Lovett <address@hidden> writes:
>> On Jun 13, 2016, at 5:59 AM, John J Foerch <address@hidden> wrote:
>>
>> Hello,
>>
>> I was pruning dependencies from a program of mine recently, and noticed
>> that I was using coops-utils only for 'instance-of?'. The thought
>> occurred to me that as 'instance-of?' is such a common and useful
>> operation, perhaps it belongs in coops proper. I wanted to at least put
>> the idea out there and see what people thought. It would be a bit
>> self-serving for me, as I could drop several dependencies from my
>> program if this change were made.
>
> Hum, something get added to coops. Suggest you define the following in your
> code:
>
> (define-inline (*subclass? c1 c2) (or (eq? c1 c2) (subclass? c1 c2)))
>
> (define (instance-of? x class) (*subclass? (class-of x) class))
>
> subclass? & class-of are part of coops.
>
Alright, thank you for the suggestion. I am just curious whether others
feel as I do that 'instance-of?' is an important enough operation that
it could be promoted into the coops egg. Personally I find that I use
it in just about every coops program I write.
Thank you,
--
John Foerch