0

I know that there are a couple of singletons around that can be used to quickly return "common" values from Guile C extension functions, like:

SCM_UNSPECIFIED
SCM_BOOL_F

and others.

I would expect that returning #nil from a C function would be just as easy, but I have yet to find the proper constant or the proper way.

Returning NULL is a no-go.

So, the question is: how do I return #nil from a C extension function?

And if doing so is relatively convoluted, is there a reason for that (e.g. maybe returning #nil is not idiomatic in Scheme)?

Rick77
  • 3,121
  • 25
  • 43

1 Answers1

1

I think I have found a way, although not necessarily the best one.

There is an:

SCM_ELISP_NIL

which I was dissing due to the ELISP in the name (turns out, with good reasons).

Turns out it returns a proper #nil and a cursory check on the C code shows it's not an alias for something more Guile-specific.

My own interpretation is that #nil is not idiomatic but something provided for ELISP portability, and I should probably return an empty list instead.

Rick77
  • 3,121
  • 25
  • 43