guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GOOPS question


From: Mikael Djurfeldt
Subject: Re: GOOPS question
Date: Fri, 30 Apr 2021 17:15:03 +0200

Preferably, the dispatch should be done as much as possible during compile
time such that it takes zero time during runtime.

On Fri, Apr 30, 2021 at 4:50 PM Mikael Djurfeldt <mikael@djurfeldt.com>
wrote:

> Generic method dispatch is *supposed* to be fast. It was fast once upon a
> time. We should fix that.
>
> On Fri, Apr 30, 2021 at 2:19 PM Stefan Israelsson Tampe <
> stefan.itampe@gmail.com> wrote:
>
>> If performance is important, a goops solution can be slow in vector-ref
>> and vector-set! operations due
>> to two reasons. (I have pounder an implementation of resizable python
>> lists and here is my tips),
>>
>> 1. slot-ref/slot-set! is slow (I try to fix this using the much more
>> difficult struct-ref/struct-set!)
>> 2. generic-method-dispatch is slow, I try to make a wrapper function in
>> which we short cut for
>> python/sheme internal types and if they do not match use the
>> generic method.
>>
>>
>> On Fri, Apr 30, 2021 at 1:57 PM Mikael Djurfeldt <mikael@djurfeldt.com>
>> wrote:
>>
>>> On Fri, Apr 30, 2021 at 1:11 AM Damien Mattei <damien.mattei@gmail.com>
>>> wrote:
>>>
>>> > for example in the doc there is:
>>> > (define-class <my-complex> (<number>) r i #:name "Complex")
>>> >
>>> > seems <number> superclass is of no use
>>> >
>>>
>>> Well, it certainly *is* of use in the sense that methods operating on
>>> <number> will immediately start to also accept <my-complex> as an
>>> argument.
>>> That might seem worrisome but is not if there is some agreement on which
>>> operations should be implemented for all numbers. So, if you had
>>> previously
>>> written an algorithm which operates on numbers, there's now a good chance
>>> that it would also work for <my-complex> objects.
>>>
>>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]