guile-user
[Top][All Lists]
Advanced

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

Re: anyone define port types?


From: Andy Wingo
Subject: Re: anyone define port types?
Date: Sat, 11 Jun 2016 18:50:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

On Wed 06 Apr 2016 01:55, Matt Wette <address@hidden> writes:

>> On Apr 5, 2016, at 7:06 AM, Mark H Weaver <address@hidden> wrote:
>> 
>> Matt Wette <address@hidden> writes:
>> 
>>>> On Mar 28, 2016, at 12:04 PM, Andy Wingo <address@hidden> wrote:
>>>> I am working on improving our port implementation to take advantage of
>>>> the opportunity to break ABI in 2.2.  I am wondering how much I can
>>>> break C API as well -- there are some changes that would allow better
>>>> user-space threading
>>> 
>>> I made an attempt to use soft ports, but backed out after I could not
>>> figure a way to extra data I wanted to associate with my port.
>>> 
>>> Addition of an access function to user-defined data would enlarge the
>>> cases for which soft ports could be used.
>> 
>> Object properties can be used to associate extra information with any
>> object that has identity, which includes ports.  See
>> 'make-object-property' in the Guile manual.
>
> Thanks.  I had forgotten about that. — Matt

I think for soft ports (and custom binary i/o ports) the idea is
actually that the "handler" procedures are actually closures.  I.e.

  (let ((my-obj ...))
    (make-soft-port (vector (lambda (c) (do-write my-obj c)) ...) modes))

No need for extra arguments if you have closures.

Andy



reply via email to

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