unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* dumping arbitrary structures
@ 2004-01-26 22:22 farazs
  2004-01-26 22:30 ` Paul Jarc
  0 siblings, 1 reply; 7+ messages in thread
From: farazs @ 2004-01-26 22:22 UTC (permalink / raw)



hi

        I'm looking for something which can dump *arbitrary* guile
structures to a byte(or scm_t_bits) array - so that they may be
transmitted (send()) and recieved and reconstructed cleanly on the
other end. It could also be used to save data structures to a file
and restore them later on.

If anyone has done this please point it out to me.

- faraz < farazs@yapost.com >




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dumping arbitrary structures
  2004-01-26 22:22 dumping arbitrary structures farazs
@ 2004-01-26 22:30 ` Paul Jarc
  2004-01-26 23:50   ` Andreas Rottmann
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Jarc @ 2004-01-26 22:30 UTC (permalink / raw)
  Cc: guile-user

farazs@yapost.com wrote:
>         I'm looking for something which can dump *arbitrary* guile
> structures to a byte(or scm_t_bits) array - so that they may be
> transmitted (send()) and recieved and reconstructed cleanly on the
> other end. It could also be used to save data structures to a file
> and restore them later on.

(with-output-to-string (lambda () (write object)))
That will work for built-in data types like lists, vectors, numbers,
strings, symbols, etc.  User-defined records and classes are a harder
problem.


paul


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dumping arbitrary structures
  2004-01-26 22:30 ` Paul Jarc
@ 2004-01-26 23:50   ` Andreas Rottmann
  2004-01-28  1:55     ` Clinton Ebadi
  2004-01-28  7:39     ` farazs
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Rottmann @ 2004-01-26 23:50 UTC (permalink / raw)
  Cc: guile-user

prj@po.cwru.edu (Paul Jarc) writes:

> farazs@yapost.com wrote:
>>         I'm looking for something which can dump *arbitrary* guile
>> structures to a byte(or scm_t_bits) array - so that they may be
>> transmitted (send()) and recieved and reconstructed cleanly on the
>> other end. It could also be used to save data structures to a file
>> and restore them later on.
>
> (with-output-to-string (lambda () (write object)))
> That will work for built-in data types like lists, vectors, numbers,
> strings, symbols, etc.  User-defined records and classes are a harder
> problem.
>
For classes you might use something like described in
http://unknownlamer.org/code/guile-web-manual.html#SEC4.

Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Make free software, not war!


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dumping arbitrary structures
  2004-01-26 23:50   ` Andreas Rottmann
@ 2004-01-28  1:55     ` Clinton Ebadi
  2004-01-28  7:39     ` farazs
  1 sibling, 0 replies; 7+ messages in thread
From: Clinton Ebadi @ 2004-01-28  1:55 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 26 January 2004 18:50, Andreas Rottmann wrote:
> prj@po.cwru.edu (Paul Jarc) writes:
> > farazs@yapost.com wrote:
> >>         I'm looking for something which can dump *arbitrary* guile
> >> structures to a byte(or scm_t_bits) array - so that they may be
> >> transmitted (send()) and recieved and reconstructed cleanly on the
> >> other end. It could also be used to save data structures to a file
> >> and restore them later on.
> >
> > (with-output-to-string (lambda () (write object)))
> > That will work for built-in data types like lists, vectors, numbers,
> > strings, symbols, etc.  User-defined records and classes are a harder
> > problem.
>
> For classes you might use something like described in
> http://unknownlamer.org/code/guile-web-manual.html#SEC4.

Speaking of which, I just uploaded 0.4.0 which features a new serializer. It
should actually work this time around. It is still a *huge* hack and *very*
inefficient. I'm not working too much on guile-web anymore (or programming in
general...I've gotten lazy and spend my time chasing girls and being in a
metal band that isn't going anywhere).

- --
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog
I use Free Software because I value freedom over features.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAFxaadgGh8PQDV0sRAlASAJ9KA2ZxQX5f6ZQGTwELQzjZT/JvvACgl60y
4azctvyj8oJMTKGwvk8/XtU=
=r9Sx
-----END PGP SIGNATURE-----


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dumping arbitrary structures
  2004-01-26 23:50   ` Andreas Rottmann
  2004-01-28  1:55     ` Clinton Ebadi
@ 2004-01-28  7:39     ` farazs
  2004-01-28 13:18       ` Thien-Thi Nguyen
  2004-01-28 22:47       ` Clinton Ebadi
  1 sibling, 2 replies; 7+ messages in thread
From: farazs @ 2004-01-28  7:39 UTC (permalink / raw)


> For classes you might use something like described in
> http://unknownlamer.org/code/guile-web-manual.html#SEC4.
>

    The object-serializer in guile-web is pretty much what
I want except for the "object" part. I don't particularly fancy
OOP (actually haven't seen too much).

    Secondly, my actual motive for asking this question was
not exactly to exchange data over the web ; I want to use guile
on a Linux cluster along with PVM : the idea is to use PVM to
beam down thunks of Scheme to execute on the slave nodes.

    Ultimately the conversion to string approach is a bit too
slow for my purposes. I would prefer a more low level approach
that works with all in-built types and can be extended to smobs
if needed by something like set_smob_dump(tag, funcptr) and
set_smob_restore(tag, funcptr)

     But more pertinently I would like to raise the question of
serializing everything : The ability to save closures, thunks,
continuations, etc. to files can in itself allow us to do some
pretty funny stuff. We could have truly persistent environments -
you know how after a days work on emacs you can save the file
and resume work on it later.

   Imagine this message :

Guile dumped core... Pick it up tomorrow and continue


   This feature is mentioned in the TODO list of guile-web,
which means that atleast Clinton is thinking on the lines that
I am. I wanna know if anyone else finds it useful too?

- faraz < farazs@yapost.com >


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dumping arbitrary structures
  2004-01-28  7:39     ` farazs
@ 2004-01-28 13:18       ` Thien-Thi Nguyen
  2004-01-28 22:47       ` Clinton Ebadi
  1 sibling, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2004-01-28 13:18 UTC (permalink / raw)
  Cc: guile-user

   From: farazs@yapost.com
   Date: Wed, 28 Jan 2004 15:39:20 +0800 (HKT)

   Ultimately the conversion to string approach is a bit too
   slow for my purposes.

what are your requirements, quantitatively?

   But more pertinently I would like to raise the question of
   serializing everything : [...] We could have truly persistent
   environments [...]

that's what a database is for, generally.  just a SMOP (you could
revive gush or beguiled); arrange for the daemon to checkpoint to
a database backend either automatically or on demand.

thi


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dumping arbitrary structures
  2004-01-28  7:39     ` farazs
  2004-01-28 13:18       ` Thien-Thi Nguyen
@ 2004-01-28 22:47       ` Clinton Ebadi
  1 sibling, 0 replies; 7+ messages in thread
From: Clinton Ebadi @ 2004-01-28 22:47 UTC (permalink / raw)
  Cc: guile-user

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 28 January 2004 02:39, farazs@yapost.com wrote:
> > For classes you might use something like described in
> > http://unknownlamer.org/code/guile-web-manual.html#SEC4.
>
>     The object-serializer in guile-web is pretty much what
> I want except for the "object" part. I don't particularly fancy
> OOP (actually haven't seen too much).

By "object" I meant any Scheme data, not objects in the OOP sense. I do make 
heavy use of GOOPS but only because it provides an easy way to identify types 
and to do some /very/ unorthodox things (e.g. mass changing values in place) 
by abusing some of the internal procedures (The serializer is in essence a 
hack so I'm allowed to do that ;) ).

- -- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog
I use Free Software because I value freedom over features.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAGDwCdgGh8PQDV0sRAgsKAKCGATOeh7Q5rs7wUTnyjpA0pTIjmQCeIMOP
P/nuahzxaG0EoKSbYP7cYg8=
=dbFQ
-----END PGP SIGNATURE-----


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-01-28 22:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-26 22:22 dumping arbitrary structures farazs
2004-01-26 22:30 ` Paul Jarc
2004-01-26 23:50   ` Andreas Rottmann
2004-01-28  1:55     ` Clinton Ebadi
2004-01-28  7:39     ` farazs
2004-01-28 13:18       ` Thien-Thi Nguyen
2004-01-28 22:47       ` Clinton Ebadi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).