This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: signal error from my smob_func


Sergey Dolin <dsa-ugur@chel.surnet.ru> writes:

> If all is ok my func would return new smob (object what is oracle session)
> If logon fail - func could return simple #f, but i do need the right
> smob to be returned in order to get error message...
> 
> So this will not work:
> (let ((session (o:log "scott" "tiger" "mydb")))
>   (if session
>         (...)
>         (display (o:erhms session))))

what about:

(let ((session (o:log "whatever")))
  (cond
   ((o:error? session)
    (display (o:ehrms session)))
   (else
    (...))))

?

the gist of which is: the returned object should be identifiable as an
error object (aka "condition object").  it could be just a string, for
all I know.

> Probably continuation will be better?
> ...Is where standard solution for what?

well, not standard in the ANSI sense, but at least there are some
standard approaches and terminology.

I think that the nicest approach is the "condition system" approach.

see http://srfi.schemers.org/srfi-12 (withdrawn, unfortunately, but
it's the right idea and may give you some methodological hints).

uspehov,
--mike

-- 
Politics is non-euclidean.                           -- Robert Anton Wilson

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]