[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: foreign objects and the garbage collector
From: |
Maxime Devos |
Subject: |
Re: foreign objects and the garbage collector |
Date: |
Tue, 21 Sep 2021 20:49:55 +0200 |
User-agent: |
Evolution 3.34.2 |
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
signature.asc
Description: This is a digitally signed message part