[Haskell-cafe] Re: Getting my feet wet - not in Haskell though

Joachim Durchholz jo at durchholz.org
Sun Dec 24 13:36:57 EST 2006


rossberg at ps.uni-sb.de schrieb:
> Joachim Durchholz wrote:
>> I'll move on to the alternatives - Alice ML and/or Clean. Both can 
>> serialize without forcing lazy subexpressions.
> 
> I don't know about Clean, but with respect to Alice ML this is not 
> correct: Alice ML uniformly blocks on futures upon pickling,
> including lazy ones.

Bad enough, but not necessarily a showstopper: lazy data structures 
aren't idiomatic in ML (I just hope they aren't in Alice ML either).

> Sometimes you may want to pickle lazy suspensions as such, but more
> often it is not what you want. In particular, the suspension can
> easily be larger than its result,

I'd say that in this case, the suspension should have been forced 
earlier. I.e. the problem is not in the pickling but in the suspension 
being larger than its result.
I'm entirely unsure how to determine when a suspension should be forced 
anway. The programmer could give hints, but that would probably break 
all kinds of abstraction barrier; and the system usually doesn't have 
enough information to decide when it should do it. Seems like one of 
those problems that generate lots of PhD papers...

> and the closure may contain resources which cannot be pickled. If
> such a suspension was produced by an abstraction you may even argue
> that making contained resources observable partially breaks the 
> abstraction.

Well, Alice ML doesn't serialize things that don't make sense outside 
the originating process (i.e. resources).
That's better than silently serializing a file handle and being 
surprised by that handle meaning an entirely different file after 
unpickling.
OTOH one could do even better. Simply unpickle a resource as a proxy for 
the original resource in the originating process. (If the process has 
died, assume that the resource was closed - the vast majority of 
resource types has a "closed/unusable" state anyway.)

> To adhere to uniformity, strong abstraction, and the Principle of
> Least Surprise, we thus chose to force lazy futures in Alice ML.

Well, I wouldn't have expected that pickling has an effect (other than 
wrapping the value up for transfer), so at least I would have been 
greatly surprised.
I even dislike to see something like that in a language that has side 
effects.
But you can't have everything anyway ;-)

Regards,
Jo



More information about the Haskell-Cafe mailing list