On Jan 7, 2007, at 10:14 AM, minh thu wrote:

> Hi,
>
> I'd like to write a small library along the lines of the mailbox egg.
> The goal is to have a queue where the elements are ordered by some
> kind of value attached to them (in my case, it will be the moment when
> the element has to be extracted from the queue).

So essentially a priority queue.
Exactly, just forgot the name...


>
> Reading the code, and being fairly new to scheme and chicken, I have
> some questions:
>
> - why is there a queue.scm file ? Is it because usage of the extras
> unit can be disabled ?

No. Because the extras unit doesn't disable interrupts. Mailbox
doesn't synchronize access to its globals explicitly but disables
interrupts, so the entire file is a critical-section.
Does that mean that when a file disables interrupts, when calling code
from another unit, it could be interrupted ?

So using a (disable-interrupts) declaration is a bit like making all
methods of a java class synchronised ?


> - what are those ##sys#xxx and ##core#xxx functions ?
>  is it permitted (good style) to use them ? where are they
> documented ?

Permitted, yes.

Good style? Well, I wouldn't use them unless necessary, or unless
hacking in someone else's code that does use them. You may notice
that 'queue.scm' defines wrappers around the '##sys' access routines
so the main body of the code calls very few directly. And some
operations are just not available outside of the sys namespace, in
which case they must be used.

Documented, no.
Thanks, but, what are they ? What can I use instead of ##sys#slot ? In
the present case, is it ok to use them ?


>
> When/if I complete the writing of such a library, would it be good to
> add it to Eggs Unlimited ?
> Have you an idea for its name ? ordered-mailbox ?

Sure.

Ok, thanks !
mt


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to