[clean-list] Wish list =+ New *World

Peter Achten P.Achten at cs.ru.nl
Fri Aug 24 14:25:53 MEST 2007


Dear all,

 From Shivkumar's first posting:
/"Similarly, in my work (numerical solution of PDEs), I often need to 
manipulate large quantities of intermediate data (matrix factorizations, 
and so forth), which I would like to store in external files rather than 
in memory. Even though these calculations are deep inside my code, I 
must still thread *World all the way in. Again, it would be nice not to 
have to do that. If createWorld could give me a fresh virtual partition 
of the hard disk, this problem could be solved easily."
/
To me it seems that Shivkumar would like to be able to annotate data 
(with a keyword, say "external") in order to let the compiler store the 
data on disk rather than in memory. This is similar to persistent 
programming languages where variables really refer to external, 
persistent objects (analogous to how a file name refers to file 
content). Such a language feature does not free you from handling this 
data in a single-threaded way, so the data should still be attributed as 
unique. If not, you would have to store versions of these data 
structures, and my guess is that this rapidly gets out of control.

I agree with Andrew's posting: the whole point of Clean's file I/O 
system is to "partition the hard disk", this is literally what an 
individual File does. From Shivkumar's account above, I gather that the 
data is already present, and hence "a fresh virtual partition of the 
hard disk" will not aid you, because you specifically wish to get to 
precise data. If you do wish a fresh partition (File), then what you're 
really after is something like

    newFile :: *File

in the same style that you create a fresh unique array. Like Andrew 
suggested, this file should not be visible externally, otherwise 
referential transparancy can get compromised. I suspect such a function 
can be included without harm because the file is, in a sense, anonymous. 
More difficult is one with a string parameter to point to a specific file:

    newFile2 :: String -> *File

because for two expressions str1 and str2 such that str1 = str2, 
(newFile2 str1) = (newFile2 str2). It can not be determined at 
compile-time whether two expressions yield the same result. One would 
have to resort to run-time error messages, but this is undesirable due 
to unpredictable evaluation orders: either the first is evaluated and 
the second aborts, or vice versa, or, worse, one is performed after the 
other is completely done and everything seems all right!

Regards,
Peter Achten

Shivkumar Chandrasekaran wrote:
> Resuming my previous thread on access to external commands in Clean.
>
> It would be really nice to have access to a function like (createWorld 
> :: *World) that returned a brand new world (equivalent to say a new 
> partition on the hard disk) but more like how createArray returns a 
> fresh unique array. It seems it would be really nice to live in a many 
> worlds universe :-)
>
> For example, I was requesting that we have a function to execute 
> external command-line utilities:
>
> command :: {#Char} *World -> (Int, *World)
>
> However, if I use this deep inside my code somewhere, I *must* thread 
> *World all the way from Start to my local call site. (This happens in 
> Haskell I believe). However, if I can create local unique Worlds (just 
> like unique arrays), I can avoid this situation.
>
> Similarly, in my work (numerical solution of PDEs), I often need to 
> manipulate large quantities of intermediate data (matrix 
> factorizations, and so forth), which I would like to store in external 
> files rather than in memory. Even though these calculations are deep 
> inside my code, I must still thread *World all the way in. Again, it 
> would be nice not to have to do that. If createWorld could give me a 
> fresh virtual partition of the hard disk, this problem could be solved 
> easily.
>
> --shiv--
>
> PS: Of course the user should not expect any synchronization between 
> multiple *World's, especially for GUIs.
>
>
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list


More information about the clean-list mailing list