[racket] Suggestion for saving preferences

From: Erich Rast (erich at snafu.de)
Date: Tue Apr 5 05:23:25 EDT 2011

It depends a bit on what your program is used for and how long it is
supposed to remain in use. If you intend to use it for a long time (> 10
years) or might later need to read prefs with a program written in
another language, consider using XML.

You need two procedures for each struct, struct->struct-sxml and
struct-sxml->struct. You can use SSAX or another sxml tool for the
latter. Then convert SXML to XML when you write it to disk.

Of course, if it's just a small program using struct->list and
list->struct is just fine. If you can't afford program crashs, though,
you'll still need to validate the input from the prefs, though.

Also, please make a versatile preferences class that handles storing and
restoring, versions with up- and downwards compatibility, etc., and put
it on Planet. ;-)



On Tue, 2011-04-05 at 00:49 -0300, Eduardo Bellani wrote:

> * Use serializable structs,orse file to edit by hand.
> * Create some functions like algorithm->list list->algorithm. The only
>   drawback I see is that I will have to create variations for each struct.
> Does anybody have a suggestion/alternative?
> Thanks for the time.

Posted on the users mailing list.