[Haskell] Re: Global Variables and IO initializers
ahey at iee.org
Mon Nov 8 01:54:59 EST 2004
On Monday 08 Nov 2004 1:55 am, Benjamin Franksen wrote:
> [moving to haskell-cafe]
> Sorry for the long post.
[moving back to haskell]
Hope you'll exuse me if I don't respond to everything here, just
don't have the stamina. But maybe this..
> Timber doesn't even have top-level IO actions, instead
> everything you need from the environment is given as an argument to main.
> Mark that Timber is used for real-time control, an inherently stateful and
> IO intensive field.
> Your opinion that it automatically leads to a horrible API if you have
> to pass the initialized state around amounts to saying that in an OO
> language like Eiffel only libraries with horribly inconvenient APIs can
> be written. This is ridiculous.
It would be ridiculous if this was my opinion, but it ain't. Or to be
more precise I think the O'Haskell (and I presume Timber and maybe Eiffel)
approach to state is absolutely right. Unfortunately it just ain't that
easy to apply these ideas in Haskell as it is (which is why O'Haskell
was produced in the first place I guess).
However, turning Haskell into O'Haskell seems like a far more radical
suggestion than the (IMO) conservative language extension under
discussion. So I don't expect it to happen anytime soon. Maybe if
Haskell ever gets a better records/modules system things might look
a bit different. But there doesn't seem to much prospect of that
happening either at the moment.
BTW, I also think there are some important differences between the
O'Haskell way (which I don't object to) and what you and Keaan are
advocating AFAICT (which I do object to).
More information about the Haskell