Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I have some questions regarding hoot.

- is there some sort of enum or constant?  the (rnrs enums) guile module is not available.

- how can I use  #:print  with define-record-type?, bytevectors printed using pk are not very informative; and I can't use pk in a module so I'm not sure how to create a print function.

- what is the use case for the call-external function?. It seems that it allows direct access of javascript function without the need of a binding.

(1 edit)
  1. We don't have (rnrs enums) built-in. We have very little R6RS support, in general. It might be possible to import it from Guile itself but it's more likely that it will have some unmet dependencies. Scheme doesn't have a "define constant" expression, in general, but if you were to do (define foo 42) then Guile's compiler will perform constant propagation to optimize all references to foo if it is never modified with set!
  2. Here's an example of a custom printer. The #:printer keyword comes before all the usual record type specification. https://codeberg.org/spritely/hoot/src/branch/main/test/test-records.scm#L116
  3. call-external is for invoking a reference to an external function (a JS function in practice). Let's say you have a foreign binding like (define-foreign foo "example" "foo" -> (ref extern)) and the (ref extern) is expected to a function reference. call-external provides an easy way to call that external function almost as if it were a Scheme procedure.