first-class modules
Jorge Adriano
jadrian@mat.uc.pt
Tue, 26 Mar 2002 20:02:59 +0000
> On Tuesday 26 March 2002 17:31, you wrote:
> A number of people have discussed the use of implicit parameters to
> mimic global variables in Haskell. I am wondering if any have done the
> same for a first-class module system such as that proposed by Shields
> and Jones. It seems to make a tremendous amount of sense to do it that
> way:
>
> 1. semi-constant values: Things that are calculated or input at the
> beginning of the program could be handled by Main.main, which would pass
> the results to the Second module, whose main function it could then
> call. This seems much more natural than the implicit parameter approach
> for this purpose.
It seems nice for that *specific* purpose. What I like about implicit
parameters is the fact that they are a more general approach, and that is IMO
very important.
You, might for instance, decide that maybe it would be a good idea to, under
certain specific conditions, change one of those "semi-constant" values.
Imagine some AI algortithm, you iterate some learning function 'learnF' over
and over again. Now you realize that under certain conditions maybe the
learning rate (used in learnF) should be changed.
Chaging your implementation would be easy with implicit parameters.
J.A.