adriano schreef op di 21-09-2021 om 16:26 [+0200]:
> 
> [...]
> Well, it'd be wonderful to have an example of what you're describing
> here ! 🙂️
> 
> The new exceptions system is still quite obscure 🤷️

Ignoring with-throw-handler, raise-continuable and pre-unwind handlers, it's
the same mechanism as in Java or Python, though with different syntax, and
unlike Java, Guile doesn't have ‘finally’:

;; Can also be implemented with the old 'catch' -- 'catch' isn't disappearing.
(guard (c (#t (close-resource-unless-closed the-resource)
              (raise-exception c)))
  (define-values return-values (do-stuff))
  (close-the-resource-unless-closed the-resource)
  (apply values return-vales))

Greetings,
Maxime

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to