Re: Windows registry handling / hugs CVS repository?
Antony Courtney antony@apocalypse.org writes:
I think that the way hugs uses the registry under Windows is dangerous and buggy. This message describes the problems and proposes some alternative designs. I welcome comments and suggestions.
... points deleted....
Hi, I'm mostly in agreement with what you're saying & it's a good thing you bring it up. However, I think that the use of the Registry for storing options is a Good Thing, and shouldn't be scrapped just because the current interface has a flaw (or two.) It's a good thing because: - the current interface provides a simple way for users to configure their setup. I'd claim that twiddling with environment variables isn't as straightforward for many Windows platform users (which in some cases means editing autoexec.bat and restarting.) - it simplifies the work of installation software; not just an installer for Hugs itself, but libraries that are distributed separately (via the Projects subkey.) - it lets you configure machine-wide Hugs settings, something that's fiddly to do using environment variables (.bat or shell scripts that wrap the hugs executable; tedious.) Setting the machine-wide Hugs settings could be easier though (at the moment, you'll have to use a Registry editor.) - it avoids running into notorious problems with not big enough environment blocks on various Win9x systems, should the length of an environment variable like HUGSFLAGS become too long. So, the question is more what is an appropriate and safer way of configuring the Hugs registry settings. Alastair implemented the current behaviour, and has identified before the very weakness you bring up. My suggestion would be the following: - if there's a HUGSFLAGS environment variable, use it & ignore the registry. Keeps people that prefer & are accustomed to env. vars happy. - :set doesn't persist to the registry. - provide an option like :regsave for persisting to the Registry. A nop if you're using environment variables. :set emits an informational message telling the user that :regsave is now needed to achieve persistence. - provide a UI for changing the options. WinHugs does this well (via the Options dialog); HaskellScript also via one of its samples, and you could easily imagine an applet that came with the Hugs distribution which did the same thing (I wrote a Hugs98 control panel applet which did just this sometime ago, and I could locate the code if there's interest in providing something like this.) The UI could also let you modify the environment variable, at least on Win2k and NT systems. i.e., not too far from what you're suggesting. BTW, re: buffers - the Registry API (RegQuery*) lets you query the size of a string value (REG_SZ), so there's really no need to guess string lengths, they can be precisely determined. --sigbjorn
participants (1)
-
Sigbjorn Finne