environment access (Was: The fate of S, K and I)
Pascal Serrarens
pascalrs@cs.kun.nl
Mon, 22 Feb 1999 10:37:04 +0100
Graham,
matthews@math.uga.edu wrote:
> Pascal Serrarens wrote:
> > not very flexible. The new Clean 2.0 will have a more flexible module system
> > were you can create functions in a local scope.
>
> Is there any documentation for what is coming in Clean 2.0? Specifically
> will Clean 2.0 have first class modules?
There is no documentation for Clean 2.0, as far as I know. It is still in
development and features might change. I am not working on Clean 2.0,
therefore I can't aswer specific quetions.
> Also there was a recent discussion between Pascal Serrarens and someone
> else on the list comparing Clean I/O to Haskell style monadic I/O (and
> the "do" notation). In this discussion something was mentioned along the
> lines that Clean's I/O is the way it is so that it can support "multiple
> environments". The suggestion was that since Haskell I/O did not support
> multiple environments it was somehow "unsafe". I have quoted all these
> things because I am not sure what is being talked about here. I was
> wondering if anyone (hopefully Pascal?) could post an article/example/
> reference outlining the issues.
First, I want to state that it is not true that supporting multiple
environments is needed for safety. It was the reference-style used in Haskell
wich caused the problem.
I do not know a paper which compares reference style and multiple environemts
with respect to safety directly. But I can give you some references to papers
which discuss monads and environments. First on the Haskell monadic system,
this includes the reference passing style and suggestions for concurrency.
@inproceedings{LaunchburyPeytonJones1994a,
author = "Launchbury, J. and {Peyton Jones}, S.L.",
title = "Lazy Functional State Threads",
address = "Orlando",
publisher = "ACM Press",
booktitle = "Programming Languages Design and Implementation",
year = "1994",
scope = "impmonads",
abstractURL = "http://www.cse.ogi.edu/~jl/biblio.html",
documentURL = "http://www.cse.ogi.edu/~jl/Papers/stateThreads.ps"
}
Phil wadler proposed a system which did not use references, but a separate
environments system.
@inproceedings{Wadler1992a,
author = "Wadler, P.",
title = "The essence of functional programming",
booktitle = "Annual ACM Symp. on Principles of Prog. Languages",
year = "1992"
}
The problem with separate environments and monads is that it is hard to mix
multiple monads. Several papers have been written trying to find a elegant and
flexible way:
@article{Kagawa1997a,
author = "Kagawa, K.",
title = "Compositional References for Stateful Functional Programming",
journal = "1997 ACM SIGPLAN International Conference on Functional
Programming (ICFP'97)",
address = "Amsterdam, The Netherlands",
month = "June",
year = "1997",
pages = "217--226"
}
@inproceedings{KingWadler1992a,
author = "King, D.J. and Wadler, P.",
title = "Combining Monads",
booktitle = "Functional Programming, Glasgow 1992",
editors = "Launchbury, J. and Sansom, P.M.",
publisher = "Spring Verlag",
series = "Workshops in Computing",
year = "1993",
note = "to appear"
}
@inproceedings{HolyerSpiliopoulou1998a,
author = "Holyer, I. and Spiliopoulou E.",
title = "Concurrent Monadic Interfacing",
pages = "253--270"
booktitle = "Implementation of Functional Languages, 10th International
Workshop, Draft Proceedings",
year = "1998",
editor = "Hammond, K. and Davie, T. and Clack, C.",
address = "London, UK"
}
For Clean's approach to multiple environments, take a look at Peter Achten's work:
@article{AchtenPlasmijer1995a,
author = "Achten, P.M. and Plasmeijer, M.J.",
title = "The Ins and Outs of {Clean I/O}",
journal = "Journal of Functional Programming",
year = "1995",
volume = "5",
number = "1",
pages = "81--110",
publisher = "Cambridge University Press",
scope = "graphics",
abstractURL = "ftp://ftp.cs.kun.nl/pub/Clean/papers/ins_outs.abs",
documentURL = "ftp://ftp.cs.kun.nl/pub/Clean/papers/ins_outs.ps.Z",
documentSize= "131.8 kbytes",
keywords = "GUI I/O system of {Clean}"
}
@phdthesis{Achten1996a,
author = "Achten, P.M.",
title = "Interactive Functional Programs - Models, Methods and Implementation",
school = "University of Nijmegen",
year = "1996",
month = "February"
}
The example file_func2 in my previous mailing on this subject is a good
example of what could go wrong, I think.
--
Pascal Serrarens
Concurrent Clean developer
University of Nijmegen, NL