Thursday, March 4, 2004, 4:33:29 PM, Romano wrote:

> I should like to define a common (standard) interface for async
> protocols.

> I proposed some time ago an object! style, like the View feel,
> instead of the awake function.

> What do you think?

Sorry if that's missing the point, but I'm currently using something
like the following in my async:// experiments:

-- snip --
async-handler: context [
    ; default error handler
    on-error: func [ port [port!] error [error!] ] [
        print mold disarm error
        true
    ]

    ; default async event handlers
    on-connect: func [ port [port!] ] [ false ]
    on-close:   func [ port [port!] ] [ attempt [ close port ] true ]
    on-read:    func [ port [port!] ] [ false ]
    on-write:   func [ port [port!] ] [ false ]

    ; default dispatcher
    handle: func [ port [port!] state [word! error!] ] [
        either error? state [
            on-error port state
        ] [
            switch state [ 
                connect     [ on-connect port ]
                close       [ on-close port ]
                read        [ on-read port ]
                write       [ on-write port ]
            ]
        ]
    ]
]
-- snap --

The 'handle dispatcher is to smoothly use object!'s based on the above
as 'awake handler.

-- 
Best regards,
 Andreas


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to