dotgnu-visionaries
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Visionaries] WebScheme


From: Peter Minten
Subject: Re: [Visionaries] WebScheme
Date: Sun, 11 May 2003 11:46:22 +0200

The loose end hunt continues.

--

How do you attach metadata to a value in a field definition? This can be done
using [attribute^ value], the ^ suffix simply tells the reader to expand to
(set! address@hidden value) instead of (set! address@hidden value).
The reason I'm not giving fields the ^ prefix is that you'll more often give
metadata to fields than to values.

--

Guile has something called weak references. When something an object
weak-references to is garbage collected the object is garbage collected too. I'm
going to implement this too, but using triggers. Every object has a on-finalize
trigger, simply hook up to that to know when an object gets garbage collected.
Every object also has a force-finalize method, which is the destructor, note
that this method garbage collects even if there are active references to the
object. A safer way is the safe-finalize method, which only garbage collects
when there are no active references to the object anymore (only needed with GC
off). So a weak-reference from a to b can be written as (b.on-finalize.add
(lambda () a.force-finalize)) in the body of a. This mechanism also provides
enough flexibility to make a clean escape of the destructed variable possible
(for example connecting prev and next in a double linked list list).

There is a garbage collector object GC, with a field active. When active is set
to #f the GC is deactivated and the app must do explicit garbage collection.

Greetings,

Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]