caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] lazy and marshal
@ 2003-06-17 15:21 sicard
  2003-06-17 15:55 ` Kip Macy
  2003-06-17 17:44 ` Damien Doligez
  0 siblings, 2 replies; 5+ messages in thread
From: sicard @ 2003-06-17 15:21 UTC (permalink / raw)
  To: caml-list

Hello
I don't understand the following error :
Marshalling a lazy value don't work when the value has not been computed.


# let a = lazy 0;;
val a : int lazy_t = <lazy>
# Marshal.to_string a [ Marshal.Closures ] ;;
Exception: Invalid_argument "output_value: abstract value".

# Lazy.force a;;
- : int = 0
# Marshal.to_string a [ Marshal.Closures ] ;;
- : string =
"\132\149??\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000@"
#

Thanks

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] lazy and marshal
  2003-06-17 15:21 [Caml-list] lazy and marshal sicard
@ 2003-06-17 15:55 ` Kip Macy
  2003-06-17 17:44 ` Damien Doligez
  1 sibling, 0 replies; 5+ messages in thread
From: Kip Macy @ 2003-06-17 15:55 UTC (permalink / raw)
  To: sicard; +Cc: caml-list

Marshal stores values or data structures, a lazy value by definition 
is one whose evaluation has been deferred. In order for the marshalling
of lazy values to work, the thunk (or however deferred evaluation is 
handled in ocaml) and all the environment that it depends on would have
to be marshalled.

On Tue, 17 Jun 2003 sicard@poleia.lip6.fr wrote:

> Hello
> I don't understand the following error :
> Marshalling a lazy value don't work when the value has not been computed.
> 
> 
> # let a = lazy 0;;
> val a : int lazy_t = <lazy>
> # Marshal.to_string a [ Marshal.Closures ] ;;
> Exception: Invalid_argument "output_value: abstract value".
> 
> # Lazy.force a;;
> - : int = 0
> # Marshal.to_string a [ Marshal.Closures ] ;;
> - : string =
> "\132\149??\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000@"
> #
> 
> Thanks
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] lazy and marshal
  2003-06-17 15:21 [Caml-list] lazy and marshal sicard
  2003-06-17 15:55 ` Kip Macy
@ 2003-06-17 17:44 ` Damien Doligez
  2003-06-19  9:46   ` Pierre Weis
  1 sibling, 1 reply; 5+ messages in thread
From: Damien Doligez @ 2003-06-17 17:44 UTC (permalink / raw)
  To: sicard; +Cc: caml-list

On Tuesday, June 17, 2003, at 05:21 PM, sicard@poleia.lip6.fr wrote:

> Hello
> I don't understand the following error :
> Marshalling a lazy value don't work when the value has not been  
> computed.
>
>
> # let a = lazy 0;;
> val a : int lazy_t = <lazy>
> # Marshal.to_string a [ Marshal.Closures ] ;;
> Exception: Invalid_argument "output_value: abstract value".
>
> # Lazy.force a;;
> - : int = 0
> # Marshal.to_string a [ Marshal.Closures ] ;;
> - : string =
> "\132\149??\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000 
> \000@"
> #


# Marshal.to_string (fun x -> x) [ Marshal.Closures ];;

You cannot marshall the functional values that are compiled
by the toplevel.  This is a limitation of the toplevel, not
lazy values.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] lazy and marshal
  2003-06-17 17:44 ` Damien Doligez
@ 2003-06-19  9:46   ` Pierre Weis
  2003-06-19 12:46     ` Damien Doligez
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Weis @ 2003-06-19  9:46 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list, sicard

> You cannot marshall the functional values that are compiled
> by the toplevel.  This is a limitation of the toplevel, not
> lazy values.
> 
> -- Damien

Could you elaborate a bit on this ?

What is specific to the functional values compiled by the toplevel ?

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] lazy and marshal
  2003-06-19  9:46   ` Pierre Weis
@ 2003-06-19 12:46     ` Damien Doligez
  0 siblings, 0 replies; 5+ messages in thread
From: Damien Doligez @ 2003-06-19 12:46 UTC (permalink / raw)
  To: Pierre Weis; +Cc: caml-list, sicard

On Thursday, June 19, 2003, at 11:46 AM, Pierre Weis wrote:

>> You cannot marshall the functional values that are compiled
>> by the toplevel.  This is a limitation of the toplevel, not
>> lazy values.
>>
>> -- Damien
>
> Could you elaborate a bit on this ?
>
> What is specific to the functional values compiled by the toplevel ?

Their byte-code is allocated dynamically and does not lie between
code_area_start and code_area_end.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2003-06-19 12:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-17 15:21 [Caml-list] lazy and marshal sicard
2003-06-17 15:55 ` Kip Macy
2003-06-17 17:44 ` Damien Doligez
2003-06-19  9:46   ` Pierre Weis
2003-06-19 12:46     ` Damien Doligez

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 NNTP newsgroup(s).