unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* scm_with_continuation_barrier returning #f on throws ?
@ 2010-09-06 11:20 Cedric Cellier
  2010-09-25 14:36 ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: Cedric Cellier @ 2010-09-06 11:20 UTC (permalink / raw)
  To: guile-user

Hello !

With guile-1.8.7, scm_with_continuation_barrier does not seam to return
SCM_BOOL_F on error. I did this :

static void *load_file(void *filename)
{
    scm_c_primitive_load((char const *)filename);
    scm_force_output(scm_current_output_port());
    return NULL;
}

...

SCM res = scm_with_guile(load_file, "a_file_that_doesnt_exist");

Thus, scm_c_primitive_load displays an ERROR message and throws out.
But scm_with_guile, ie. the underlying scm_with_continuation_barrier,
returns 0x0.

Is the bug in the doc, in the code or once again in my head ?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: scm_with_continuation_barrier returning #f on throws ?
  2010-09-06 11:20 scm_with_continuation_barrier returning #f on throws ? Cedric Cellier
@ 2010-09-25 14:36 ` Andy Wingo
  2010-09-26  5:30   ` rixed
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Wingo @ 2010-09-25 14:36 UTC (permalink / raw)
  To: Cedric Cellier; +Cc: guile-user

Hi Cedric,

On Mon 06 Sep 2010 13:20, Cedric Cellier <rixed@happyleptic.org> writes:

> SCM res = scm_with_guile(load_file, "a_file_that_doesnt_exist");

This statement is ill-formed, because you shouldn't have references to
SCM objects outside of Guile. This is indicated by scm_with_guile's
return value, which is void* and not SCM.

The docs about scm_with_continuation_barrier are correct; it does indeed
return #f on a throw. But scm_with_guile uses
scm_c_with_continuation_barrier, which is different, because it returns
a C value, a void*. The error case there has it return NULL.

Regards,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: scm_with_continuation_barrier returning #f on throws ?
  2010-09-25 14:36 ` Andy Wingo
@ 2010-09-26  5:30   ` rixed
  0 siblings, 0 replies; 3+ messages in thread
From: rixed @ 2010-09-26  5:30 UTC (permalink / raw)
  To: guile-user

Sorry, my bad, I just can't read code (hopefully I'm paid to /write/ some :-))




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-26  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 11:20 scm_with_continuation_barrier returning #f on throws ? Cedric Cellier
2010-09-25 14:36 ` Andy Wingo
2010-09-26  5:30   ` rixed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).