Re: case syntax and symbols

2005-06-06 Thread Marius Vollmer
Kevin Ryde <[EMAIL PROTECTED]> writes: > Marius Vollmer <[EMAIL PROTECTED]> writes: >> >> We we already warn when importing something that shadows a core >> definition, so we could as well warn when redefining one. > > I thought about that for my lint program and decided it'd be too > annoying to

Re: case syntax and symbols

2005-06-06 Thread Marius Vollmer
Neil Jerram <[EMAIL PROTECTED]> writes: > Marius Vollmer wrote: >> Hmm. There are two things here that might want a warning: >> redefining >> something that was a macro as a variable; > > Sounds good; and vice versa? Yes, and vice versa. > By the way, has your idea about having "identifier -> m

Re: case syntax and symbols

2005-06-06 Thread Marius Vollmer
[EMAIL PROTECTED] (Ludovic Courtès) writes: > There is probably code that relies on redefinitions being silently > interpreted as a `set!', I'm afraid. So I don't think Guile should > start issuing warnings for redefinitions by default. The warnings would be about redefinitions that would not ha

Re: case syntax and symbols

2005-05-26 Thread Neil Jerram
Ludovic Courtès wrote: Hi, Neil Jerram <[EMAIL PROTECTED]> writes: Or are you thinking of a "redefinition" as something different to what I'm thinking? The case I'm thinking of is where a file contains a definition, and you load that file twice (perhaps via use-modules, but that's not import

Re: case syntax and symbols

2005-05-26 Thread Ludovic Courtès
Hi, Neil Jerram <[EMAIL PROTECTED]> writes: > Or are you thinking of a "redefinition" as something different to what > I'm thinking? The case I'm thinking of is where a file contains a > definition, and you load that file twice (perhaps via use-modules, but > that's not important). What I'm thi

Re: case syntax and symbols

2005-05-24 Thread Neil Jerram
Ludovic Courtès wrote: Hi, Neil Jerram <[EMAIL PROTECTED]> writes: Isn't the rule we want "whenever a new definition shadows an existing definition in a module, and the existing definition did not originate in the current module"? This rule would also avoid giving unwanted warnings when an e

Re: case syntax and symbols

2005-05-24 Thread Ludovic Courtès
Hi, Neil Jerram <[EMAIL PROTECTED]> writes: > Isn't the rule we want "whenever a new definition shadows an existing > definition in a module, and the existing definition did not originate > in the current module"? This rule would also avoid giving unwanted > warnings when an edited module is rel

Re: case syntax and symbols

2005-05-23 Thread Neil Jerram
Marius Vollmer wrote: Hmm. There are two things here that might want a warning: redefining something that was a macro as a variable; Sounds good; and vice versa? By the way, has your idea about having "identifier -> macro" instead of "identifier -> variable -> macro" been implemented yet?

Re: case syntax and symbols

2005-05-22 Thread Kevin Ryde
Marius Vollmer <[EMAIL PROTECTED]> writes: > > We we already warn when importing something that shadows a core > definition, so we could as well warn when redefining one. I thought about that for my lint program and decided it'd be too annoying to report local bindings that shadow, but I did set u

Re: case syntax and symbols

2005-05-22 Thread Marius Vollmer
Neil Jerram <[EMAIL PROTECTED]> writes: >> Also (and don't try this at home kids): >> (define 'x (* x x)) >> '2 >> => 4 > > And presumably (or in my view) this is all fine, except for the last > example, where Guile should signal an error or at least give a > warning. Right? Hmm. There are

Re: case syntax and symbols

2005-03-22 Thread Marius Vollmer
[EMAIL PROTECTED] (Ludovic Courtès) writes: > Sure it is, but I can't reproduce it with either 1.6.7 or 1.7.2, hence > my sadness. ;-) What happens? This should work in all version of Guile... ___ Guile-user mailing list Guile-user@gnu.org http://li

Re: case syntax and symbols

2005-03-22 Thread Ludovic Courtès
Marius Vollmer <[EMAIL PROTECTED]> writes: > Hmm, no, I meant (define 'x (* x x)). I think '2 => 4 is pretty > funny, no? :-) Sure it is, but I can't reproduce it with either 1.6.7 or 1.7.2, hence my sadness. ;-) Ludovic. ___ Guile-user mailing li

Re: case syntax and symbols

2005-03-22 Thread Marius Vollmer
[EMAIL PROTECTED] (Ludovic Courtès) writes: > Actually, you meant something like: > > guile> (define x 2) > guile> (define 'x 3) > guile> x > 2 > guile> 'x > 3 > > Right? The example you gave doesn't produce anything funny unless `x' > was previously defined. Hmm, no, I meant (define

Re: case syntax and symbols

2005-03-22 Thread Ludovic Courtès
Marius Vollmer <[EMAIL PROTECTED]> writes: > Also (and don't try this at home kids): > > (define 'x (* x x)) > '2 > => 4 Obviously, I did try this at home. :-) Actually, you meant something like: guile> (define x 2) guile> (define 'x 3) guile> x 2 guile> 'x 3 Right? The exa

Re: case syntax and symbols

2005-03-22 Thread Neil Jerram
Marius Vollmer wrote: It is a bit tricky. The syntax 'x is short for (quote x). This expansion is done by the reader without looking at the context. So, what the evaluator really sees is (case 'x ((quote x) #t) (else #f)) This is indeed in the form required by R5RS, although probably o

Re: case syntax and symbols

2005-03-21 Thread Marius Vollmer
Aaron VanDevender <[EMAIL PROTECTED]> writes: > Hello, > > I have noticed that guile evaluates the following to #t > > (case 'x > ('x #t) > (else #f)) > > even though R5RS section 4.2.1 seems to say that all of the statements > (besides else) must be of the form ((datum ...) ...). Clearly the

case syntax and symbols

2005-03-21 Thread Aaron VanDevender
Hello, I have noticed that guile evaluates the following to #t (case 'x ('x #t) (else #f)) even though R5RS section 4.2.1 seems to say that all of the statements (besides else) must be of the form ((datum ...) ...). Clearly the symbol 'x is not a list. What is going on here? Is this an agree