[Haskell-cafe] global variables

Isaac Dupree isaacdupree at charter.net
Sun May 20 14:53:57 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adrian Hey wrote:
> Isaac Dupree wrote:
>> Maybe some sort of ISOLATE, DON'T_OPTIMIZE (but CAF), or
>> USED_AS_GLOBAL_VARIABLE pragma instead of just the insufficient NOINLINE
>> would be a good first step... if successful it would remove the
>> occasional need for -fno-cse for a whole module in GHC, at least.
> 
> I have a hard time trying to understand why anyone would prefer
> this to the simple and clear <- syntax that's been proposed. As
> for the ACIO monad itself, this is utterly trivial and requires
> no language change. It's just a library.
> 
> Maybe the first pragma you propose might have other uses to control
> optimisations, so I'm not totally anti this. But generally I
> dislike pragmas (I always find myself wondering what's wrong
> with the language design that makes the pragma necessary).
> 
> So pragmas that influence optimisation are something I can
> live with. But using pragmas to influence *semantics* really
> is an evil practice IMO and is something that should be
> discouraged, not made an unavoidable necessity.

Indeed.  My rationale:

 - It would get some reliable semantics implemented in GHC (and/or other
compilers hopefully).  Since what we have already is a multi-part hack,
this might be a nontrivial/important piece of work, and should make such
things more reliable.
 - Pragmas (NOINLINE) are already used to influence semantics here.
This idea doesn't introduce anything "worse" than that.  And it doesn't
require that people subscribe to particular syntax, ACIO implementation,
etc.
 - Once implemented, if I understand correctly (do I?), it should make
it easier for non-Simon to try out the hard work of a "real" solution
involving non-pragma-syntax changes, ACIO libraries, or whatever is desired.

Not because I think it's a great solution (nor even deserve to be called
a real "solution" at all), but because nothing is being implemented now,
for whatever reason.  So I'm putting out this idea, in case it's a step
in the right direction that someone is willing to take.

Isaac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUJlEHgcxvIWYTTURAiGRAJ9ovzlD1Tc/Ce5tbCbYBBGcWLX/9ACfYzc3
a+xC3hQrXB3V9Iq+0vzxnmg=
=EGk7
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list