This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: "Magic" Variables?



>The only thing that bothers me is that general parameters don't need
>this active processing, so there end up being two different ways to
>get and set things.

That's a good point, especially if it's not clear from their meanings
which parameters need it and which don't.  Also, what happens when, as
time goes by, a parameter changes from a straight variable to a magic
variable?  In Emacs, people generally just have to update their config
files.

Here's a suggestion, which may be just more trouble than it's worth,
but anyway:

Define a new syntactic form (set-param! SYM EXPR) which sets the
parameter named SYM to EXPR.  There's some static table which
set-param! consults to find out whether it should expand to (set! SYM
EXPR) or (SYM EXPR).  It's got a companion form (param SYM), which
does the analogous thing for references.

That way, the user doesn't have to know which variables are which, and
you can change the meaning without breaking config files.

On the downside:
1) It's yet another bunch of syntax.
2) You know people will try set!, perhaps by accident.  Sometimes it
   will work, and other times it will have annoying consequences.
   (This problem could go away if the variables lived in a separate
   module from the one the config files are evaluated in.  Too hairy
   for you yet?)
3) People writing customization modules for scwm might not use it all
   the time, so you'll still have a mixture of set!'ed variables and
   other magic, re-introducing the original consistency and defeating
   the whole point.