guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic variable binding


From: Keith Wright
Subject: Re: Dynamic variable binding
Date: Fri, 19 Dec 2008 19:17:51 -0500

> From: Sebastian Tennant <address@hidden>
> 
> > Quoth Keith Wright <address@hidden>:
> 
> > I don't know what happens (in Guile), but I can tell
> > you what _should_ happen.  (In my humble opinion as
> > a demi-god of semantics.)
> 
> I'm trying to wrap my head around symbols, variables
> and names of variables.  They seem to me to be three
> different things.

NB: I hate emoticons.  The lack of a smiley face does
not imply seriousness.  This sort of thing has been
puzzling a lot of people for a long time.  In particular,
I published a paper about it some 25 years ago, but have
since decided that I don't know enough to be publishing.
That's why it's fun to rave on the mailing list.

> > (define 'foo "bar")
> >
> > There are several possibilities
> >
> > (1) error message in define
> >   (1a) Rude: Thou fool! |quote| is not a variable
> >   (1b) Polite: If you are sure you want to do that,
> >        write out the quote, don't use apostrophe
> >   (1c) Obscure: Bad variable in def_schkdt
> 
> To be really semantically accurate should we not say:
> 
> (1a) Thou irrepressible fool! |quote| cannot be
>      the _name_ of a variable.
> (1c) Obscure: Bad variable _name_ in def_schkdt.

I almost understand something about symbols and variables,
but the _name_ of a variable is not a technical term.
I don't name variables, I just call them "this variable"
or "that variable", or sometimes describe them as
the "local variable |foo|".

> > But you are asking the wrong question.  Ask not
> > what happens when a symbol is defined, ask what
> > you can do to make the macro define an unquoted
> > variable.
> 
> Answer: Pass it an unquoted variable.
> 
> Is that the answer you expected?

I am not sure I expected it, but it makes me feel good
to know that it works.

> My semantic point is that the first argument to
> definer (above) is not a symbol and it's not a
> variable (an unbound variable error would be thrown
> if it was), so in the context of the first agument to
> define there is a third data type; 'variable name'.

I am quite sure that it _is_ a variable, because the
Scheme report, in the section on Variable Definitions,
says:

   (define <variable> <expression>)
   ...define binds <variable> to a new location...

you yourself say "pass it an unquoted variable".

There is no unbound variable error, because the
whole point of |define| is to bind a variable.
It expects an unbound variable, but it must be
a variable or else it would not become a bound
variable after the |define| form binds it.

  -- Keith

"The name of the song is called 'Haddocks' eyes'."
"Oh, that's the name of the song, is it?"
 Alice said.
"No, you don't understand," the Knight said, looking
 a little vexed.
"That's what the name is _called_."

  -- Lewis Carroll, Through the Looking Glass and
     what Alice found there (1871)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]